这是我的代码:如何扩展类型类
bool ch=Type.IsBuiltIn("System.Int32"); // not working-> syntax error
public static class MyExtentions
{
public static bool IsBuiltIn(this Type t, string _type)
{
return (Type.GetType(_type) == null) ? false : true;
}
}
请我想IsBuiltIn新方法
这里你不需要扩展方法 –
把'typeof(int).IsBuiltIn'写到你的编辑器中。你看到了什么? – I4V
您传递给IsBuiltIn()方法的字符串应该是该类型的程序集限定名称。我的意思是你应该通过System.Int32 insted只是int – Dimitri