我对获得返回类型有疑问.
class SampleOnOUTandREF
{
static void Main(string[] args)
{
Console.Write(typeof(int));
Console.Read();
}
}
Run Code Online (Sandbox Code Playgroud)
如果我写这个输出是System.Int32.
但在我的应用程序中,如果我给"System.Int32",我希望结果为"int".请帮忙解决这个问题.在我的应用程序中,我使用System.Reflection来读取.dll的.
int 是一个C#特定的关键字.
Reflection库与语言无关,并且不知道C#特定的关键字.
相反,您可以编写一个Dictionary<Type, string>包含C#关键字类型.