Search code examples
c#winforms.net-assemblyapplication-nameexecutable-path

What is the right way of getting my WinForms application's name?


I could do this

return Assembly.GetEntryAssembly().GetName().Name;

or

return Path.GetFileNameWithoutExtension(Application.ExecutablePath);

Would both give the desired application name always? If so which is a more standard way of getting application name? If its still a no-win situation is there anything like one method is faster than the other? Or else is there any other right approach?


Solution

  • Take a look at Application.ProductName and Application.ProductVersion