Assembly first knowledge

xiaoxiao2021-03-05  25

I saw the articles about the program version on the past few days ago, I would like to override my own program. "About".

Take AssemblyTitle ( "WEB main program"), AssemblyConfiguration ( ""), AssemblyCompany ( "XX"), AssemblyProduct ( "Management"), AssemblyCopyright ( "? 2004 XX"), AssemblyTrademark ( "") AssemblyCulture ( "") The information is easy, all like object [] attrcompany = system.reflection.Assembly.GetexecutingAssembly ().

GetCustomattributes ((AssemblyCompanyAttribute), false);

IF (Attrcompany.Length> 0)

{

LBLCompany.text = (Attrcompany [0] as askemblycompanyattribute) .company;

} This takes this.

But when you take the program version, there is a problem. If you take the above code, I don't know why is a null value. I am very wonderful, like writing attributes in assemblyinfo.cs files, why is it null?

After more than three hours of groping, I finally found a solution: object attrversion = system.reflection.Assembly.GetexecutingAssembly (). Getname (). Version; this is right. It turns out that those attributes above are customer-defined properties, and Version is basic attribute, so there is this difference. Due to the limited level of this, please refer to it.

转载请注明原文地址:https://www.9cbs.com/read-33600.html

New Post(0)