Get a list of distinct values in List

后端 未结 5 1314
孤城傲影
孤城傲影 2020-11-27 12:01

In C#, say I have a class called Note with three String member variables.

public class Note
{
    public string Title;
    public string Author;
    public s         


        
5条回答
  •  误落风尘
    2020-11-27 12:23

    Notes.Select(x => x.Author).Distinct();
    

    This will return a sequence (IEnumerable) of Author values -- one per unique value.

提交回复
热议问题