Convert/Copy ICollection to Array
This is just a code sample to copy the values from any ICollection type to array. I don’t know why some methods in .Net still expects only array type of input, why not ICollection type!!! So I had to convert every time to array type. This is really boring
so this helper method is handy for me.
/// <summary>
/// Arrays from ICollection object.
/// </summary>
/// <param name="collection">ICollection object</param>
/// <returns>String array type</returns>
public string[] GetArrayFromICollection(ICollection collection)
{
string[] array = new string[collection.Count];
collection.CopyTo(array, 0);
return array;
}

Youre so cool! I dont suppose Ive read something like this before. So nice to seek out any individual with some original thoughts on this subject. realy thanks for starting this up. this web site is one thing that is needed on the web, someone with somewhat originality. useful job for bringing one thing new to the internet
news feed
February 7, 2013 at 3:21 am