convert a FileInfo array into a String array C#

前端 未结 4 1155
春和景丽
春和景丽 2021-01-05 05:17

I create a FileInfo array like this

 try
            {
                DirectoryInfo Dir = new DirectoryInfo(DirPath);
                FileInfo[] FileList =          


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-05 06:11

    If you want to go the other way (convert string array into FileInfo's) you can use the following:

    string[] files;
    var fileInfos = files.Select(f => new FileInfo(f));
    List infos = fileInfos.ToList();
    

提交回复
热议问题