Getting Type of Array Members

  • Thread starter Thread starter Laszlo Szijarto
  • Start date Start date
L

Laszlo Szijarto

I'm iterating through various members of a struct using Reflection. While I
can use fieldInfo.FieldType.BaseType to determine that a member is an array,
how do I determine what that array is an array of.

e,g., I want it to tell me that a UInt32[] member is an Array of UInt32 (via
code).

Thank you,
Laszlo
 
Laszlo,

If you have the Type of the array, you can call the GetElementType
method on the Type to get the Type of the elements contained in the array.

Hope this helps.
 
Type.GetTypeArray?

If you already know the array is homogeneous, can you not do a
array[0].GetType() ?

vJ
 
Back
Top