Home
類庫(kù)下載
C# class library
Anatomy of AssemblyInfo.cs - Learn about commonly used attributes Attribute



Anatomy of AssemblyInfo.cs - Learn about commonly used attributes Attribute
Oct 14, 2016 pm 05:09 PM
Core code
using System.Reflection; using System.Runtime.InteropServices; // 有關(guān)程序集的常規(guī)信息通過(guò)下列特性集 // 控制。更改這些特性值可修改 // 與程序集關(guān)聯(lián)的信息。 [assembly: AssemblyTitle("MusicStore")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("MusicStore")] [assembly: AssemblyCopyright("Copyright ? Microsoft 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 將 ComVisible 設(shè)置為 false 會(huì)使此程序集中的類型 // 對(duì) COM 組件不可見。如果需要 // 從 COM 訪問此程序集中的某個(gè)類型,請(qǐng)針對(duì)該類型將 ComVisible 特性設(shè)置為 true。 [assembly: ComVisible(false)] // 如果此項(xiàng)目向 COM 公開,則下列 GUID 用于 typelib 的 ID [assembly: Guid("a9ef3281-9049-4a52-a2f1-2061d442200e")] // 程序集的版本信息由下列四個(gè)值組成: // // 主版本 // 次版本 // 內(nèi)部版本號(hào) // 修訂版本 // // 可以指定所有值,也可以使用“修訂號(hào)”和“內(nèi)部版本號(hào)”的默認(rèn)值, // 方法是按如下所示使用 "*": [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]E I. Global attributes Most characteristics are suitable for specific language elements (such as class or methods), but some attributes are global they are applicable. to the entire assembly or module. For example: AssemblyVersionAttribute attribute can be used to embed version information into an assembly. Global attributes appear in source code before any top-level using directives and before any type, module or namespace declarations. Global attributes can appear in multiple source files, however, the files must be compiled in a single compile pass. In C# projects, they are in the AssemblyInfo.cs file. Assembly attributes are values ??that provide information about the assembly. They are divided into the following categories: ?、貯ssembly identification characteristics ?、贗nformational characteristics ③Assembly manifest characteristics ?、躍trong name characteristics 1. Assembly identification characteristics Three characteristics (use strong names , if applicable) Determine the assembly's identity: name, version, and culture. When referenced in code, these attributes form the full name of the assembly required. Using attributes, you can set the version and culture of an assembly. However, the name value is set by the compiler, in the Assembly Information dialog box of the Visual Studio IDE, after the assembly is created, according to the file that contains the assembly manifest. The AssemblyFlagsAttribute attribute specifies whether multiple copies of an assembly can coexist.
/// <summary> /// 舊類 /// </summary> [Obsolete("請(qǐng)使用 " + nameof(NewClass))] class OldClass { public void Method() { } } /// <summary> /// 新類 /// </summary> class NewClass { [Obsolete("請(qǐng)使用 " + nameof(NewMethod), true)] public void OldMethod() { } public void NewMethod() { } }rrree
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article
Grass Wonder Build Guide | Uma Musume Pretty Derby
1 months ago
By Jack chen
Roblox: 99 Nights In The Forest - All Badges And How To Unlock Them
4 weeks ago
By DDD
Uma Musume Pretty Derby Banner Schedule (July 2025)
1 months ago
By Jack chen
RimWorld Odyssey Temperature Guide for Ships and Gravtech
3 weeks ago
By Jack chen
Windows Security is blank or not showing options
1 months ago
By 下次還敢

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)