User6996
User6996

Reputation: 3013

Add dir to 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'

Upvotes: 2

Views: 1020

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039588

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

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

Upvotes: 4

Related Questions