assembly.load

C# Assembly.Load vs Assembly.ReflectionOnlyLoad

半世苍凉 提交于 2019-12-02 17:51:34
I'm trying to understand the differences between Assembly.Load and Assembly.ReflectionOnlyLoad. In the code below I am attempting to find all of the objects in a given assembly that inherit from a given interface: var myTypes = new List<Type>(); var assembly = Assembly.Load("MyProject.Components"); foreach (var type in assembly.GetTypes()) { if (type.GetInterfaces().Contains(typeof(ISuperInterface))) { myTypes.Add(type); } } This code works fine for me, but I was doing some research into other possibly better alternatives and came across Assembly.ReflectionOnlyLoad() method. I assumed that

Recompile C# while running, without AppDomains

邮差的信 提交于 2019-11-30 10:36:34
问题 Let’s say that I have two C# applications - game.exe (XNA, needs to support Xbox 360) and editor.exe (XNA hosted in WinForms) - they both share an engine.dll assembly that does the vast majority of the work. Now let’s say that I want to add some kind of C#-based scripting (it’s not quite "scripting" but I’ll call it that). Each level gets its own class inherited from a base class (we’ll call it LevelController ). These are the important constraints for these scripts: They need to be real,

Recompile C# while running, without AppDomains

给你一囗甜甜゛ 提交于 2019-11-29 21:01:52
Let’s say that I have two C# applications - game.exe (XNA, needs to support Xbox 360) and editor.exe (XNA hosted in WinForms) - they both share an engine.dll assembly that does the vast majority of the work. Now let’s say that I want to add some kind of C#-based scripting (it’s not quite "scripting" but I’ll call it that). Each level gets its own class inherited from a base class (we’ll call it LevelController ). These are the important constraints for these scripts: They need to be real, compiled C# code They should require minimal manual "glue" work, if any They must run in the same