views:

118

answers:

2

Hello,

I'm trying to add my plugins to my application via Assembly.LoadFrom and I would like to know if there's a property to know what type of assembly was loaded - dynamically linked library and executables can be loaded, right?

Thank you!

+6  A: 

You can determine whether the Assembly returned by the LoadFrom function has loaded an EXE or DLL using the Assembly.EntryPoint property. If the property returns a MethodInfo for the entry point function, then you are dealing with an EXE.

From MSDN:

Type: System.Reflection.MethodInfo An object that represents the entry point of this assembly. If no entry point is found (for example, the assembly is a DLL), null is returned.

http://msdn.microsoft.com/en-us/library/system.reflection.assembly.entrypoint.aspx

fletcher
Thanks! I'll upvote you tomorrow.
MartyIX
+1  A: 

If you want to know if it was a .exe or a .dll, you can check Assembly.Location.

Jouke van der Maas