Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何获取已定义文本的类型_C#_.net_Visual Studio 2010 - Fatal编程技术网

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

我能用C语言做这个吗


有谁能帮我创建泛型类型转换器而无需执行多个条件吗

这需要使用程序集限定名,除非类型是在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)
关于类型转换,请查看