O'Reilly logo

Special Edition Using C# by NIIT

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Attribute Instance

An attribute instance is an instance of the attribute class. You initialize an attribute instance with the named and positional arguments.

Compiling the Attribute

There are a number of steps that are performed when the compiler encounters an attribute in C# code. The steps are as follows:

1.
When the compiler encounters a statement that instantiates an attribute, it locates a constructor for the attribute class.
2.
If a public constructor is found, it is invoked.
3.
If the constructor found does not have public accessibility, a compilation error occurs.
4.
For each named argument mentioned for the attribute, a nonstatic read-write public field or property must be present in the attribute. If no such field or property ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required