O'Reilly logo

Introducing Visual C# 2010 by Adam Freeman

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

Chapter 17. Attributes

You have seen how modifiers like public and abstract can be applied to classes, interfaces, and other types to change how they behave. The .NET attribute feature allows you to create and apply your own modifiers without having to add keywords to the C# language.

In this chapter, I'll show you two of the many dozens of attributes that are included in the .NET Framework Class Library, how to test for the presence of an attribute, and how to create and apply custom attributes. Table 17-1 provides the summary for this chapter.

Table 17-1. Quick Problem/Solution Reference for Chapter 17

Problem

Solution

Listings

Modify the behavior of a C# code element.

Apply an attribute.

17-1, 17-2

Test to see whether an attribute has been applied to ...

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