convertion (generics)

  • Thread starter Thread starter csharpula csharp
  • Start date Start date
C

csharpula csharp

Hello ,is there a good way to convert from string[] to List<string>. How
can I do it? Thanks a lot!
 
Hello ,is there a good way to convert from string[] to List<string>. How
can I do it? Thanks a lot!

string[] array = ...;
List<string> list = new List<string>(array);

Or using .NET 3.5 and C# 3:

var list = array.ToList();

Jon
 
Hello ,is there a good way to convert from string[] to List<string>. How
can I do it? Thanks a lot!

*** Sent via Developersdexhttp://www.developersdex.com***

Hi,

It's not entirely clear what you mean, are you refering to change all
the variables declaration you have from string[] to list<string> ?

Or are you simply worried about one particular line of code?
 
Back
Top