C# 如何获取已定义文本的类型
我能用C语言做这个吗C# 如何获取已定义文本的类型,c#,.net,visual-studio-2010,C#,.net,Visual Studio 2010,我能用C语言做这个吗 有谁能帮我创建泛型类型转换器而无需执行多个条件吗 这需要使用程序集限定名,除非类型是在mscorlib中定义的,在mscorlib中您将只能使用命名空间限定名 e、 g对于来自mscorlib的类: Type stringType = Type.GetType("System.String"); Type dependencyPropertyType = Type.GetType("System.Windows.DependencyProperty, WindowsBas
有谁能帮我创建泛型类型转换器而无需执行多个条件吗 这需要使用程序集限定名,除非类型是在mscorlib中定义的,在mscorlib中您将只能使用命名空间限定名 e、 g对于来自mscorlib的类:
Type stringType = Type.GetType("System.String");
Type dependencyPropertyType = Type.GetType("System.Windows.DependencyProperty, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
或者对于不是来自mscorlib的类:
Type stringType = Type.GetType("System.String");
Type dependencyPropertyType = Type.GetType("System.Windows.DependencyProperty, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
你能得到的最接近的方法是使用 这需要使用程序集限定名,除非类型是在mscorlib中定义的,在mscorlib中您将只能使用命名空间限定名 e、 g对于来自mscorlib的类:
Type stringType = Type.GetType("System.String");
Type dependencyPropertyType = Type.GetType("System.Windows.DependencyProperty, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
或者对于不是来自mscorlib的类:
Type stringType = Type.GetType("System.String");
Type dependencyPropertyType = Type.GetType("System.Windows.DependencyProperty, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
str.GetType()
或typeof(string)
关于类型转换,请查看str.GetType()
或typeof(string)
关于类型转换,请查看