开发者

typeconverter from dll

开发者 https://www.devze.com 2022-12-14 01:36 出处:网络
I am using the propertygrid with a class and associated type converter. When I moved the class and the TypeConverter to a dll, it seems that it is not being called.

I am using the propertygrid with a class and associated type converter. When I moved the class and the TypeConverter to a dll, it seems that it is not being called. Can't find how to activate the typeconverter f开发者_StackOverflowrom a dll.

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

Appreciate any hints. Thank you.


It could be because Assembly.LoadFile loads the file in a different binding context from the rest of your code.


Do you have something like this in place on your class:

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

Usually as long as the class has the typeconverter associated with it it should pick it up.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号