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.
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.
Output:
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.