Getting type info

There is a System.Type class available which provides us with the complete information about our object type: we can use typeof to get all the information about our class. Let's see the following code snippet:

class Program{   private static void Main(string[] args)   {      int userInput;      do      {         userInput = DisplayMenu();         switch (userInput)         {            // code omitted            case 3:            Console.Clear();            Console.WriteLine            ("Getting information using 'typeof' operator            for class 'Day05.Program");            var typeInfo = typeof(Program);            Console.WriteLine();            Console.WriteLine("Analysis result(s):");            Console.WriteLine            ("=========================");            Console.WriteLine($"Assembly:            {typeInfo.AssemblyQualifiedName}");            Console.WriteLine($"Name:{typeInfo.Name}"); Console.WriteLine($"Full ...

Get Learn C# in 7 days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.