How to Get Element Type of an Array Object?

L

Laser Lu

If I get an object with its type declared as Sysem.Array(not in the explicit
form like 'ElementType[]' in C#), then how to retrieve the exact element
type of that array?
 
J

Jon Skeet [C# MVP]

If I get an object with its type declared as Sysem.Array(not in the explicit
form like 'ElementType[]' in C#), then how to retrieve the exact element
type of that array?

myArray.GetType().GetElementType()

Jon
 
L

Laser Lu

Ok, thank you, Jon:)

Jon Skeet said:
If I get an object with its type declared as Sysem.Array(not in the
explicit
form like 'ElementType[]' in C#), then how to retrieve the exact element
type of that array?

myArray.GetType().GetElementType()

Jon
 

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

Top