开发者

Add dir to List DirectoryInfo

开发者 https://www.devze.com 2023-04-02 09:11 出处:网络
how to 开发者_开发知识库add new directory to List public static List<DirectoryInfo> Directory = new List<DirectoryInfo>();

how to 开发者_开发知识库add new directory to List

public static List<DirectoryInfo> Directory = new List<DirectoryInfo>(); 

Directory.Add("C:\\test"); // error  'string' to 'System.IO.DirectoryInfo'


You could use the DirectoryInfo constructor which allows you to pass a string which represents the path:

Directory.Add(new DirectoryInfo("C:\\test"));
0

精彩评论

暂无评论...
验证码 换一张
取 消