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

Chapter 27. C# attributes

C# attributes [1],[2] are a new feature with no equivalent in Java. [3] Put simply, C# attributes are comment-like tags enclosed in square brackets used to label or mark a class, interface, assembly, method, event, field, delegate, or method parameter in codes. Attributes enable these entities in source codes to be tagged with additional declarative information. These tags can be 'read' during runtime using C#'s built-in support for reflection.

[1] Do not be confused over the use of the term 'attribute'. In OO terminology (and also commonly in Java) the terms 'attribute', 'field', and 'property' are often used interchangeably to mean a class's field. In C#, 'fields' and 'properties' refer to different class members, ...

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