I want to get the first one if there are duplicates and discard everything if the name is the same.
Model
var data = [
{id:1, name:"Jay"},{id:2, name:"Jay"}
{id:3, name:"Jay"},{id:4, name:"Jay"}
]
wish to get
var result =[
{id:1, name:"Jay"}
]
You can group them by name and pick a first item out of the group.
var result = data.GroupBy(g => g.Name).Select(g => g.First()).ToList();