var result = EFContext.TestAddresses.Select(m => m.Name).Distinct();
另一个变体使用 where,
var result = EFContext.TestAddresses
.Where(a => a.age > 10)//if you have any condition
.Select(m => m.name).Distinct();
使用类似 sql 语法的另一种变体
var result = (from recordset
in EFContext.TestAddresses
.where(a => a.city = 'NY')//if you have any condition
.select new
{
recordset.name
}).Distinct();