How to split() a delimited string to a List

前端 未结 7 2343
被撕碎了的回忆
被撕碎了的回忆 2020-12-04 11:30

I had this code:

    String[] lineElements;       
    . . .
    try
    {
        using (StreamReader sr = new StreamReader(\"TestFile.txt\"))
        {
            


        
7条回答
  •  北荒
    北荒 (楼主)
    2020-12-04 12:12

    Just u can use with using System.Linq;

    List stringList = line.Split(',')     // this is array
     .ToList();     // this is a list which you can loop in all split string
    

提交回复
热议问题