This may be a basic question, but why can't I apply a generic type to the original type when passing a list of value types to a generic method?
IList<int> list = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8 };
Inverse<int>(list);
public void Inverse<T>(IList<T> list)
{
for (i = 0; i <= list.Count / 2; i++)
{
int a = list[i] as Int16;
int b = (int)list[i];
}
}
source
share