public virtual T MyMethod<T>()
{
if (typeof (T) != typeof (Collection<string>))
{
return default(T);
}
Collection<string> collection = new Collection<string>();
return (T)collection;
}
This method has the compile error on the red line above:
Cannot convert type 'System.Collections.ObjectModel.Collection<System.String>' to 'T'
Any reasoning would be appreciated.