C# - Print Current Assembly's Name Using GetExecutingAssembly()

Learn, how to print the current assembly name using GetExecutingAssembly() method in C#?
Submitted by Nidhi, on October 26, 2020 [Last updated : March 22, 2023]

Printing current assembly's name

Here, we will print the name of the current assembly and other information of the currently executing program using the GetExecutingAssembly() method and FullName property; here we will import the System.Reflection namespace.

C# program to print the current assembly name using GetExecutingAssembly() method

The source code to print the current assembly name using GetExecutingAssembly() method is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.

//C# program to print current assembly name 
//using GetExecutingAssembly() method.

using System;
using System.Reflection;

class Program
{
    static void Main(string[] args)
    {
        Assembly asm;
        asm     = Assembly.GetExecutingAssembly();

        Console.WriteLine(asm.FullName);
    }
}

Output

Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Press any key to continue . . .

Explanation

Here, we imported the System and System.Reflection namespace. Here we created a Program class that contains the Main() method. The Main() method is the entry point for the program. In the Main() method we printed the name of the current program assembly, version, and culture information on the console screen.

C# Basic Programs »

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.