How to Get a Sublist in C#

前端 未结 6 1556
走了就别回头了
走了就别回头了 2021-02-02 05:09

I have a List and i need to take a sublist out of this list. Is there any methods of List available for this in .NET 3.5?

6条回答
  •  情话喂你
    2021-02-02 05:20

    Would it be as easy as running a LINQ query on your List?

    List mylist = new List{ "hello","world","foo","bar"};
    List listContainingLetterO = mylist.Where(x=>x.Contains("o")).ToList();
    

提交回复
热议问题