November 09, 2005

Fun with List <T>

I didn't see a method in the 2.0 dotnet framework to 'AddRange' or adapt an IList into a List, so this was the result...

enjoy :)

jk


public List< T > ConvertListToListT< T >(System.Collections.IList list)
{
List< T > ret = new List< T >();
foreach (T o in list)
{
ret.Add(o);
}
return ret;
}

No comments: