Common Tools-application Property Information category

Source: Internet
Author: User

 

Using system; using system. collections. generic; using system. text; using system. reflection; namespace utils {// <summary> /// <para> </para> // common tool class -- Application Property Information category class // <para> ------------------------------------------------- </para >/// <para> getassemblytitle: get the application Assembly title </para> /// <para> getassemblyproduct: Get the application product name </para> /// <para> getassemblyversion: get application version </para> // <para> getassemblydescription: Get Application Program description </para> /// <para> getassemblycopyright: Obtain the copyright information of the application </para> /// <para> getassemblycompany: get the application company name </para> // <para> getassemblyappfullname: obtain the application display name </para> /// </Summary> public class assemblyhelper {# region obtain the application Assembly title /// <summary> // obtain the application assembly's title /// </Summary> /// <returns> </returns> Public static string getassemblytitle () {object [] attributes = assembly. getexecutingassembly (). getcustoma Ttributes (typeof (assemblytitleattribute), false); If (attributes. length> 0) {assemblytitleattribute titleattribute = (assemblytitleattribute) attributes [0]; If (titleattribute. title! = "") {Return titleattribute. title ;}} return system. io. path. getfilenamewithoutextension (assembly. getexecutingassembly (). codebase );} # endregion # region obtain the application product name /// <summary> /// obtain the application product name /// </Summary> /// <returns> </returns> public static string getassemblyproduct () {object [] attributes = assembly. getexecutingassembly (). getcustomattributes (typeof (assemblyproductattribute), false); If (attributes. length = 0) {return "";} return (assemblyproductattribute) attributes [0]). product ;} # endregion # region obtain the application version /// <summary> /// obtain the application version /// </Summary> /// <returns> </returns> Public static string getassemblyversion () {return assembly. getexecutingassembly (). getname (). version. tostring ();} # endregion # region get application description /// <summary> // get application description /// </Summary> /// <returns> </returns> Public static string getassemblydescription () {object [] attributes = assembly. getexecutingassembly (). getcustomattributes (typeof (assemblydescriptionattribute), false); If (attributes. length = 0) {return "";} return (assemblydescriptionattribute) attributes [0]). description ;} # endregion # region obtain the application's copyright information /// <summary> // obtain the application's copyright information /// </Summary> /// <returns> </returns> public static string getassemblycopyright () {object [] attributes = assembly. getexecutingassembly (). getcustomattributes (typeof (assemblycopyrightattribute), false); If (attributes. length = 0) {return "";} return (assemblycopyrightattribute) attributes [0]). copyright ;} # endregion # region get the application company name /// <summary> // get the application company name /// </Summary> /// <returns> </returns> public static string getassemblycompany () {object [] attributes = assembly. getexecutingassembly (). getcustomattributes (typeof (assemblycompanyattribute), false); If (attributes. length = 0) {return "";} return (assemblycompanyattribute) attributes [0]). company ;} # endregion # region obtain the application display name /// <summary> /// obtain the application display name /// </Summary> /// <returns> </returns> public static string getassemblyappfullname () {return assembly. getexecutingassembly (). fullname. tostring () ;}# endregion }}

 

Common Tools-application Property Information category

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.