【问题标题】:typeconverter from dll来自 dll 的类型转换器
【发布时间】:2009-12-17 04:26:43
【问题描述】:

我将 propertygrid 与一个类和关联的类型转换器一起使用。 当我将类和 TypeConverter 移动到 dll 时,似乎没有调用它。 找不到如何从 dll 激活类型转换器。

Assembly a = Assembly.LoadFile(modulepath + elementname + ".dll");
try
{
    object myobj = a.CreateInstance(objectname);            
    Type objecttype = myobj.GetType();
}

感谢任何提示。谢谢。

【问题讨论】:

    标签: c# propertygrid typeconverter


    【解决方案1】:

    这可能是因为 Assembly.LoadFile 将文件加载到与其余代码不同的 binding context 中。

    【讨论】:

    【解决方案2】:

    你的课堂上是否有类似的东西:

       [TypeConverter(typeof(MyClassConverter))]
     public class MyClass {
        // Insert code here.
     }
    

    通常只要类有与之关联的类型转换器,它就应该选择它。

    【讨论】:

      猜你喜欢
      • 2011-04-06
      • 2021-04-04
      • 2019-10-28
      • 2013-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多