Convert an Array to a generic list

Sometimes you have an array, but a generic list would make better sense.
Here is a method to convert from an array to a generic list.

This comes in handy if you you get an array back a web service (since they can’t return a generic list).

public static List<T> ConvertArrayToList<T>(T[] theArray)
if (theArray == null)
return null;

List<T> theList = new List<T>();

for (int i = 0; i < theArray.Length; i++)

return theList;
catch (Exception ex)
throw ;


Got something to add?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s