Type.GetType("System.String")
Run Code Online (Sandbox Code Playgroud)
是否有查找某处可用的别名?
Type.GetType("string")
Run Code Online (Sandbox Code Playgroud)
回报null
.
con*_*tor 15
这在程序上是不可能的,因为'别名'实际上是在C#中引入的关键字,并且Type.GetType
(像所有其他框架方法一样)是与语言无关的框架的一部分.
您可以使用以下值创建字典:
bool System.Boolean
byte System.Byte
sbyte System.SByte
char System.Char
decimal System.Decimal
double System.Double
float System.Single
int System.Int32
uint System.UInt32
long System.Int64
ulong System.UInt64
object System.Object
short System.Int16
ushort System.UInt16
string System.String
Run Code Online (Sandbox Code Playgroud)