0
我有一个类数据类型
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);
}
}
}
}
当我想用反射
我收到类型为
阅读在运行时的性能System.String,
System.Nullable`1 [[System.Int32,mscorlib程序,版本= 4.0.0.0, 文化=中性公钥= b77a5c561934e089]],
System.Collections.Generic.List`1 [[System.Web.Mvc.SelectListItem, System.Web.Mvc,版本= 3.0.0.0,文化=中性, 公钥= 31bf3856ad364e35]]),
但我想找回作为
string,
int?,
System.Collections.Generic.List<MyClass.ViewModel>
可有人请我提供的解决方案。
你想*友好的名字*。检查http://stackoverflow.com/questions/16466380/get-user-friendly-name-for-generic-type-in-c-sharp和http://stackoverflow.com/questions/4615553/c-sharp-get - 用户友好的名称 - 的 - 简单的类型,通过反射 – Maarten