convertion (generics)

C

csharpula csharp

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

Jon Skeet [C# MVP]

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
 
I

Ignacio Machin ( .NET/ C# MVP )

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

generics 3
Set a thread as UI 1
yield question 4
How to convert a String into Byte[] 5
StringCollection and StringDictionary 6
Generics newbie 3
Help with generics 2
Arraylist of arrays 3

Top