Created
December 6, 2013 17:32
-
-
Save kumpera/7828880 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Reflection; | |
| using System.Reflection.Emit; | |
| class Test | |
| { | |
| public static void Main () | |
| { | |
| Assembly testAssembly = typeof (Test).Assembly; | |
| string loadString = null; | |
| ResolveEventHandler handler = (s,a) => { | |
| Console.WriteLine ("------"); | |
| loadString = a.Name; | |
| return testAssembly; | |
| }; | |
| AppDomain.CurrentDomain.AssemblyResolve += handler; | |
| try { | |
| var testString = "MyDynamicType, 1.0.0.0, Culture=neutral,PublicKeyToken=0738eb9f132ed756"; | |
| // var testString = "MyDynamicType, Version=1.0.0.0, Culture=neutral,PublicKeyToken=0738eb9f132ed756"; | |
| var asm = Assembly.Load (testString); | |
| Console.WriteLine (testString == loadString); | |
| Console.WriteLine (testString); | |
| Console.WriteLine (loadString); | |
| Console.WriteLine (testAssembly == asm); | |
| } finally { | |
| AppDomain.CurrentDomain.AssemblyResolve -= handler; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment