I have a generic wrapper class that can sometimes get an array type as its generic. I can determine if the supplied generic type is an array property of IsArray. But is there a way to get the type of array elements in the code? I looked at all the public attributes of the Type object and just did not see it.
Example:
public class wrap<T> { public void doSomething() { if (typeof(T).IsArray) Type arrayElementType = typeof(T).??? ; } }
source share