I have a class
namespace MyNamespace1
{
class MyClass
{
public string MyName { get; set; }
public int? MaxHeaderLength { get; set; }
public System.Collections.Generic.List<MyClass.ViewModel> Preferences { get; set; }
}
}
namespace MyNamespace2
{
internal class myClass1
{
public static void Main(string[] args)
{
var properties = loading assembly of the MyClass of MyNamespace1
var prop = properties.GetProperties();
foreach (var propertyInfo in prop)
{
Console.WriteLine(propertyInfo.PropertyType.FullName);
}
}
}
}
When I want to read the property at the runtime using reflection
I am getting types as
System.String,
System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]],
System.Collections.Generic.List`1[[System.Web.Mvc.SelectListItem, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]),
But I want to retrieve as
string,
int?,
System.Collections.Generic.List<MyClass.ViewModel>
Can anybody please provide me the solution.