c# - What is the 2013 way to load an assembly at runtime? -


i want load several assemblies @ runtime plugin directory. core app not have references assemblies beforehand, assemblies implement interface given core app, have reference it. i found , article 2005 explaining need make work.

currently have code, linq'd version of find in article above:

foreach (     imodule module in         directory.enumeratedirectories(string.format(@"{0}/{1}", application.startuppath, modulepath))             .select(dir => directory.getfiles(dir, "*.dll"))             .selectmany(files => files.select(assembly.loadfrom)                                         .selectmany(assembly => (from type in assembly.gettypes()                                                                 type.isclass && !type.isnotpublic                                                                 let interfaces = type.getinterfaces()                                                                                                                                     ((ilist) interfaces).contains(                                                                         typeof (imodule))                                                                 select                                                                     (imodule) activator.createinstance(type))))     ) {     module.core = this;     module.initialize();     addmodule(module); } 

so current way dynamically load plugins/modules/assemblies @ runtime?

you might want @ microsoft managed extensibility framework tutorial kinda nice intro.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -