PropertyType and type...

  • Thread starter Thread starter Steph
  • Start date Start date
S

Steph

hello,
a little problem...
for a dynamic script i use :
o.GetType().GetProperty( named ).PropertyType.ToString()

and i obtain : System.Nullable`1[System.Int32]

but... i want just know "System.Int32"

how do ?



if somoene have a solution / experience...



thanks
 
auto answered :

string type;
Type t = o.GetType().GetProperty( namer ).PropertyType;
if (t.GetGenericArguments().Length > 0)
type = t.GetGenericArguments()[0].Name;
else
type = t.Name;
 

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