• Source
    1. using System;
    2. using System.Collections.Generic;
    3. using System.Reflection;
    4.  
    5.  
    6. public class Test
    7. {
    8. public static void Main()
    9. {
    10. Assembly assembly = Assembly.GetExecutingAssembly();
    11.  
    12. Console.WriteLine("The name of the assembly: " + assembly.FullName);
    13. // The name of the assembly: prog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
    14.  
    15. Console.WriteLine("Path to the assembly: " + assembly.CodeBase);
    16. // Path to the assembly: file:///home/UekYpj/prog.exe
    17.  
    18. Console.WriteLine("Is in GAC: " + assembly.GlobalAssemblyCache);
    19. // Is in GAC: False
    20.  
    21. Console.WriteLine("The version of the CLR: " + assembly.ImageRuntimeVersion);
    22. // The version of the CLR: v2.0.50727
    23.  
    24. Console.WriteLine("The path or UNC location of the assembly: " + assembly.Location);
    25. // The path or UNC location of the assembly: /home/MHap07/prog.exe
    26.  
    27. // // Is not compiled by ideone.com, possible coz it's using Mono
    28. // var typesCollection;
    29. //
    30. // typesCollection = assembly.DefinedTypes;
    31. // foreach (var element in typesCollection)
    32. // Console.Write(element+", ");
    33. // // Test, PrivateClass
    34. //
    35. // typesCollection = assembly.ExportedTypes;
    36. // foreach (var element in typesCollection)
    37. // Console.Write(element+", ");
    38. // // Test,
    39. //
    40. // Console.WriteLine("Set of security rules the CLR enforces for the assembly: " + assembly.SecurityRuleSet);
    41. // // Set of security rules the CLR enforces for the assembly: Level2
    42.  
    43.  
    44.  
    45. }
    46. }
    47.  
    48. class PrivateClass
    49. {
    50.  
    51. }