Tuesday, February 15, 2011

Convert array of strings to a list, C#

It is very easy to convert an array of string to a list in C-sharp :


// this line returns an array of file names
string[] fileEntries = Directory.GetFiles("c:/test");
List fileList = new List(fileEntries.Length);//convert an array to List

No comments: