C# tip: reading application product name and version in a WinForms application

Posted: (EET/GMT+2)

 

I blogged previously about reading an application's (assembly's) description, product name, and so forth. However, I forgot to mention that if you are writing WinForms applications, you can read the ProductName and ProductVersion properties with great ease using the Application class. This class exposes two properties with the said names, which couldn't make your life easier.

In console applications I haven't found a method that would be as easy, so you need to revert to the code I gave previously. Of course, the code will still work in Windows Forms applications as well.

But if you want to display your application's name for example in a Help/About dialog box, use the Application class. This makes your life easier.