Question: I have a `IEnumerable` ViewModel. This has the same names and I want to select only one name and display it in the header. Please suggest. 

My code is a below. I am trying to use distinct but it does not work

```
@foreach (var item in Model.abc)
{
    {
        <table>
          <tr>
            <td style="width:100px" >@Html.Label("Name")</td>
            <td style="width:225px"> @Html.DisplayTextFor(model => item.Name.Distinct())</td>
          </tr>
        </table>
    }
}

```

To be more specific: my result will have only names `{a,a,a,a,a}` so I just want to pick the single `{a}` and display it.

Answer: 
> 
> This has the same names and i want to select only one name and display
>  it in the header.
> 
> 
> 

If they all are the same and assuming `Name` implements `IEnumerable` you could try [First](http://msdn.microsoft.com/en-us/library/bb291976.aspx):

**Update**: add a new property to your model

```
otherProperty = item.Name.First();

```

Then:

```
@Html.DisplayTextFor(model => item.otherProperty)

```
**use this code in your app**

```
@foreach (var item in Model.Select(x => x.Title).Distinct())
 {
 <option>@item</option>
}

```

> 
> you can use `@html.display(X=>item)` instead `@item`
> 
> 
>