Convert List to List in C#

前端 未结 8 2286
长情又很酷
长情又很酷 2021-02-12 13:01

I want to convert a List to a List.

Here is my code:

void Convert(List stringList)
{         


        
8条回答
  •  有刺的猬
    2021-02-12 13:39

    Use the following code:

    int x = 0;
    
    var intList= stringList.Where(str => int.TryParse(str, out x)).Select(str => x).ToList();
    

提交回复
热议问题