Load and LoadFrom commands…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Reflection; using System.IO; namespace ExternalAssemblyReflector2 { class Program { static void DisplayTypesInAsm(Assembly asm) { Console.WriteLine("***Types in assembly***"); Console.WriteLine("->{0}",asm.FullName); Type[] types = asm.GetTypes(); foreach (Type t in types) Console.WriteLine("Type :{0}",t); Console.WriteLine(""); } static void Main(string[] args) { Console.WriteLine("***External Assembly Viewer"); string asmName = ""; Assembly asm = null; do { Console.WriteLine("\nEnter assembly to evaluate"); Console.WriteLine("or enter Q to quit"); asmName = Console.ReadLine(); if (asmName.ToUpper() == "Q") { break; } try { asm = Assembly.LoadFrom(asmName); // Load also possible but LoadFrom has more wide context DisplayTypesInAsm(asm); } catch { Console.WriteLine("Sorry can't find assembly"); } } while(true); } } } |
This will give
1 2 3 4 5 6 7 8 9 10 11 |
***External Assembly Viewer Enter assembly to evaluate or enter Q to quit CarLibrary.dll ***Types in assembly*** ->CarLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6a9228aea5de13fa Type :CarLibrary.EngineState Type :CarLibrary.Car Type :CarLibrary.SportsCar Type :CarLibrary.MiniVan |