
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
What are the attributes in C#?
An attribute is a declarative tag that is used to convey information to runtime about the behaviours of various elements like classes, methods, structures, enumerators, assemblies etc. in your program.
The following is the syntax.
[attribute(positional_parameters, name_parameter = value, ...)] Element
Here,
Name of the attribute and its values are specified within the square brackets, before the element to which the attribute is applied.
Positional parameters specify the essential information and the name parameters specify the optional information.
The following are the predefined attributes in C#.
AttributeUsage
The pre-defined attribute AttributeUsage describes how a custom attribute class can be used.
Conditional
This predefined attribute marks a conditional method whose execution depends on a specified preprocessing identifier.
Obsolete
Th Obsolete predefined attribute marks a program entity that should not be used. It enables you to inform the compiler to discard a particular target element
- Related Articles
- What are conditional attributes in C#?
- What are obsolete attributes in C#?
- What are predefined attributes in C#?
- What are the DataTransfer object attributes?
- What are event attributes in jQuery?
- What are the methods in jQuery to manipulate attributes?
- What are built-in class attributes in Python?
- What are the attributes of a file object in Python?
- What are the attributes of programming languages in compiler design?
- attributes in C++
- What are the attributes of a Perfect Capital Market?
- What are the attributes of a secure network in information security?
- What are various attributes Of page directive in JSP?
- what are the different attributes of MySQL ENUM data type?
- What are the attributes that work differently between React and HTML?
