This question already has an answer here:
I have simple class:
public class MyClass
{
public List<string> MyProperty { get; set; }
}
Then, I want to get name of type of MyProperty
, like this:
var name = typeof(MyClass).GetProperty("MyProperty").PropertyType.Name;
The problem is that variable name
contains value List`1, while I want to get full name List.
How can I get full, correct name of property's type?
Aucun commentaire:
Enregistrer un commentaire