オブジェクトのコレクションを、そのプロパティのひとつに基づいてソートし、ユニークな結果だけを返す方法の例をお見せしよう。

例えば、次のような「Human」クラスがあるとしよう：
```
public class Human
{
    public string Name { get; set; }
    public char Gender { get; set; }
    public int Age { get; set; }
}
```


Collectionを次のように持っているとします：
```
List<Human> humans = new List<Human>()
{
    new Human() { Name = "Alisha", Gender = 'F', Age = 22 },
    new Human() { Name = "Manish", Gender = 'M', Age = 26 },
    new Human() { Name = "Ashim", Gender = 'M', Age = 24 },
    new Human() { Name = "Sanjana", Gender = 'F', Age = 20}
};
```


次のコードは、'Age' プロパティに基づいてコレクションをソートし、コレクションからユニークなオブジェクトだけを返します。
```
var sortedHumans = humans.OrderBy(h => h.Age).Distinct();
```


以下のように、ソートされたコレクションを繰り返し処理して、プロパティを表示することができます：
```
foreach (Human human in sortedHumans)
{
    Console.WriteLine($"{human.Name} ({human.Gender}, {human.Age})");
}
```
I can show you an example of how to sort a collection of objects based on one of their properties, returning only the unique results.

Let us suppose that we have 'Human' class as follows:
```
public class Human
{
    public string Name { get; set; }
    public char Gender { get; set; }
    public int Age { get; set; }
}
```


Suppose that you have Collection as this:
```
List<Human> humans = new List<Human>()
{
    new Human() { Name = "Alisha", Gender = 'F', Age = 22 },
    new Human() { Name = "Manish", Gender = 'M', Age = 26 },
    new Human() { Name = "Ashim", Gender = 'M', Age = 24 },
    new Human() { Name = "Sanjana", Gender = 'F', Age = 20}
};
```


The following code sorts the collection based on the 'Age' property and returns only the unique objects from collection.
```
var sortedHumans = humans.OrderBy(h => h.Age).Distinct();
```


You can iterate over the sorted collection to print the properties as follows:
```
foreach (Human human in sortedHumans)
{
    Console.WriteLine($"{human.Name} ({human.Gender}, {human.Age})");
}
```