From: Francois V. <Fra...@sk...> - 2004-09-30 06:23:31
|
Martin, I have no time before tomorrow to look closer at the code you wrote but I can tell you the kind of problem I often encountered in the past. Assume you have two identical classes, one inside your main application and one put in a separate assembly. Next you reflect the latter one in your main application...it's *not* the same class as the one in your main application because the CLR takes also the signature of the assembly it belongs to. For example, on trying things like If typeof(myReflectedInstance)==Blabla.MyClass ... This will return false! The way out it using interfaces, if you assign a reflected class to an interface it will work. Netron uses this a lot, have a look at the graph lib reflection or the way NAF imports plugins. The disadvantage of this is that everything you want to use in your main app needs to be defined (via interfaces). Well, not really a problem, seems a good thing to have things under control when reflecting. I believe the divergence between classes and reflected identical classes is related to the way .Net is imposing security. There is a lot of stuff going on behind the screen with respect to security, even if one doesn't use it. Hope this helps you, if you cannot find a way out I'll look at it in the weekend. By the way, if you use Messenger you can reach me at 'NetronProject(@)hotmail.com'. See you! |