string是c#中System.String的别名,就像int和System.Int32一样,所以一直觉得他俩的使用没有区别,这次就遇到了一个问题。
在使用反射时,Type.GetType("System.string")一直为null,后来突然想起String,问题一下就解决了。
如下图:
static void Main(string[] args)
{
Type StringType = Type.GetType("System.String");
Type stringType = Type.GetType("System.string");
Console.WriteLine("大写的String:" + StringType);
Console.WriteLine("小写的string:" + Convert.ToString(stringType));
}