...

/

User-Defined Attributes (UDA)

User-Defined Attributes (UDA)

You will learn about the user-defined attributes (UDA) in this lesson.

We'll cover the following...

Introduction

Any declaration (e.g., struct type, class type, variable, etc.) can be assigned attributes, which can then be accessed at compile time to alter the way the code is compiled. User-defined attributes are purely a compile-time feature.

The user-defined attribute syntax consists of the @ sign followed by the attribute and appears before the declaration that it is being assigned to. For example, the following code assigns the Encrypted attribute to the declaration of name:

@Encrypted string name;
...