你如何标注类,类型转换器,是不是在参考答案?转换器、参考答案、类型

2023-09-06 08:51:59 作者:Beak Hyun。

我有,我已经写了一个类型转换器的一类。我想保持类型转换器独立于主解决方案,因为它是只需要在设计时,并有一个扩展项目现在包含的类型转换器。因此,当余部署,我并不需要部署的可扩展部件在所有的

不过,我无法找出适当的字符串使用的属性实际上是类连接器。注意:我不能使用这样的:

  [类型转换器(typeof运算(MyConverter)
 

因为MyConverter是在未被引用的项目。我需要使用字符串超载,但想不出用什么:

  [类型转换器(你到底去这里!)
 

我想我需要也许是路径组件,也许一个GUID,类名......只是不知道......

解决方案

  [类型转换器(类型名,AssemblyFullName)]
 
Microchip dsPIC33F SMPS AC

I have a class that I've written a TypeConverter for. I want to keep the TypeConverter separate from the main solution, as it is only needed at design time and have an extensibility project now that contains the TypeConverter. Thus, when I deploy, I don't need to deploy the extensibility assembly at all.

However, I can't figure out the appropriate string to use in the attribute to actually connect the class to the converter. Note I can't use this:

[TypeConverter(typeof(MyConverter)]

because MyConverter is in a project that isn't referenced. I need to use the string overload, but can't figure out what to use:

[TypeConverter("what the heck goes in here!")]

I think I need maybe a path to the assembly, maybe a GUID, the class name...just not sure...

解决方案

[TypeConverter("TypeName, AssemblyFullName")]