Getting assembly name

后端 未结 5 1909
灰色年华
灰色年华 2020-12-07 10:54

C#\'s exception class has a source property which is set to the name of the assembly by default.
Is there another way to get this exact string (without parsing a differe

5条回答
  •  感动是毒
    2020-12-07 11:23

    I use the Assembly to set the form's title as such:

    private String BuildFormTitle()
    {
        String AppName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
        String FormTitle = String.Format("{0} {1} ({2})", 
                                         AppName, 
                                         Application.ProductName, 
                                         Application.ProductVersion);
        return FormTitle;
    }
    

提交回复
热议问题