我有这个问题:
我想从对象信息生成一个新的源代码文件.
我做这样的事情:
dictParamMapping是Dictionary<string, Type>字符串是变量名称的地方,Type是该变量的类型.
我得到了使用以下方法构建新代码的类型:
dictParamMapping[pairProcess.Value].Type.Name (or FullName)
Run Code Online (Sandbox Code Playgroud)
当Type是int,string,datatable等......一切正常但是当它是一个字典,列表或任何其他类似的东西时它会返回如下内容:
System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Double, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
Run Code Online (Sandbox Code Playgroud)
构建新的源代码是不正确的.我想得到类似的东西Dictionary<int, double>
谁能帮我?
我需要做类似的事情:
Type CustomType = Type.GetType("instanceName");
Run Code Online (Sandbox Code Playgroud)
它始终返回null。instanceName是一个字符串,表示添加到引用中的dll中包含的类型(copyLocal属性设置为false)。
我也尝试过:
Type CustomType = Type.GetType("instanceName, dllFile.dll");
Run Code Online (Sandbox Code Playgroud)
而且还返回null。
非常感谢
亚历克斯