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.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.