Home »
.Net »
C# Programs
C# program to print the current assembly name using GetExecutingAssembly() method
Here, we are going to learn how to print the current assembly name using GetExecutingAssembly() method in C#?
Submitted by Nidhi, on October 26, 2020
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.
Program:
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 »