Attribute是c#的语言特性
msdn说明如下:
The Attribute class associates predefined system information or user-defined custom information with a target element. A target element can be an assembly, class, constructor, delegate, enum, event field,interface, method, portable executable file module, parameter, property, return value, struct, or another attribute.
Information provided by an attribute is also known as metadata. Metadata can be examined at run time by your application to control how your program processes data, or before run time by external tools to control how your application itself is processed or maintained. For example, the .NET Framework predefines and uses attribute types to control run-time behavior, and some programming languages use attribute types to represent language features not directly supported by the .NET Framework common type system.
All attribute types derive directly or indirectly from the Attribute class. Attributes can be appl

本文介绍了C#的Attribute特性,解释了Attribute如何为程序提供元数据信息,并在运行时或编译时发挥作用。特别讨论了Unity中的预定义Attribute,如DllImport,用于调用非托管代码。此外,文章还探讨了如何创建自定义Attribute,将其应用于枚举以绑定描述文本。
最低0.47元/天 解锁文章
2832

被折叠的 条评论
为什么被折叠?



