return type without the nullable

D

Dan Holmes

if i have a class like:

class Test
{
public int? ANumber { get...set...}
}

and then, using refection i read all the properties of the class how can
i get the type of the property without the Nullable part.

the type of the property ANumber would be:

System.Nullable`1[System.Int32]

I only want the System.Int32 part. Am i left to parsing the string? I
was hoping for a property/method that would return just the primitive.

dan
 
M

Mattias Sjögren

Dan,
the type of the property ANumber would be:

System.Nullable`1[System.Int32]

I only want the System.Int32 part. Am i left to parsing the string? I
was hoping for a property/method that would return just the primitive.


System.Type.GetGenericArguments should return it.


Mattias
 

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

Similar Threads


Top