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

27.2. Standard attributes

Most of the time you will be using a standard attribute provided by the .NET framework. Standard attributes are 'picked up' and interpreted by the C# compiler to have special meanings. Unlike custom attributes, you do not need to write a special attribute class to use them. They have either been coded – and are part of the .NET BCLs – or are implicitly understood by the C# compiler.

I will examine two of the three standard attributes reserved by C# first – Obsolete and Conditional. The third reserved attribute, AttributeUsage, is a bit special and is discussed in Chapter 28.

27.2.1. The Obsolete attribute

This attribute is used to mark types and type members that should no longer be used. [7] You can use this attribute ...

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