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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top