O'Reilly logo

From Java to C#: A Developer's Guide by Heng Ngee Mok

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

28.4. Custom attributes in depth

The following sections are intended for advanced developers who want to fully unleash the powers of custom attribute classes.

28.4.1. Named and positional parameters

Attribute classes can have named and positional parameters. So far, you have only written positional parameters which correspond to the parameters of a constructor in the attribute class. Figure 28.1 shows the attribute class with two overloaded constructors, hence allowing the Author attribute specification to be structured in either way as shown. No other attribute specification format is allowed. Something like [Author()] will give a compilation error because there is no corresponding constructor in the AuthorAttribute class which does not take ...

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