Getting assembly name

后端 未结 5 1881
灰色年华
灰色年华 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:22

    You can use the AssemblyName class to get the assembly name, provided you have the full name for the assembly:

    AssemblyName.GetAssemblyName(Assembly.GetExecutingAssembly().FullName).Name
    

    or

    AssemblyName.GetAssemblyName(e.Source).Name
    

    MSDN Reference - AssemblyName Class

提交回复
热议问题