How To Get Assembly Information In C#

I am sorry guys that I was not able to write articles regularly because I have some issues with my ISP so no internet. I just wanted to write something so I chose something interesting! it's about getting information about the assembly. Just create a console application in C#, import this namespace using System.Reflection; after that go to the main event and add these codes.
 Assembly assembly = Assembly.GetExecutingAssembly();
            AssemblyName assemblyName = assembly.GetName();
            string assembly_information = string.Format("{0}, {1}, {2}, {3}, {4}", assemblyName.Name, assemblyName.VersionCompatibility, assemblyName.ProcessorArchitecture, assemblyName.HashAlgorithm, assemblyName.Version.ToString());
            Console.WriteLine(assembly_information);
            Console.Read();
What that does is, first it defines the assembly events and then there’s a string with 5 slots to get the assembly information one by one. You can get more information such as KeyPair, FullName, EscapedCodeBase, ContentType, CultureInfo etc.

Just run the program to get the information and by the way don’t forget to add more slots to the string if you want to get more information about the assembly(I don’t know how it’s called I just call it slot).

1 comments:

Post a Comment

Note: Only a member of this blog may post a comment.