13.07.2015 Views

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>C#</strong> LANGUAGE SPECIFICATIONattribute-target-specifier:attribute-target :attribute-target:fieldeventmethodparampropertyreturntypeattribute-list:attributeattribute-list , attributeattribute:attribute-name attribute-arguments optattribute-name:type-nameattribute-arguments:( positional-argument-list opt )( positional-argument-list , named-argument-list )( named-argument-list )positional-argument-list:positional-argumentpositional-argument-list , positional-argumentpositional-argument:attribute-argument-expressionnamed-argument-list:named-argumentnamed-argument-list , named-argumentnamed-argument:identifier = attribute-argument-expressionattribute-argument-expression:expressionAn attribute consists of an attribute-name and an optional list of positional and named arguments. Thepositional arguments (if any) precede the named arguments. A positional argument consists of an attributeargument-expression;a named argument consists of a name, followed by an equal sign, followed by anattribute-argument-expression, which, together, are constrained by the same rules as simple assignment. Theorder of named arguments is not significant.The attribute-name identifies an attribute class. If the form of attribute-name is type-name then this namemust refer to an attribute class. Otherwise, a compile-time error occurs. [Example: The exampleclass Class1 {}[Class1] class Class2 {} // Errorresults in a compile-time error because it attempts to use Class1 as an attribute class when Class1 is notan attribute class. end example]Certain contexts permit the specification of an attribute on more than one target. A program can explicitlyspecify the target by including an attribute-target-specifier. When an attribute is placed at the global level, aglobal-attribute-target-specifier is required. In all other locations, a reasonable default is applied, but anattribute-target-specifier can be used to affirm or override the default in certain ambiguous cases (or to just308

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!