- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are predefined attributes in C#?
The following are the predefined attributes in C# −
- AttributeUsage
- Conditional
- Obsolete
AttributeUsage
The pre-defined attribute AttributeUsage describes how a custom attribute class can be used. Here is the syntax −
[AttributeUsage ( validon, AllowMultiple = allowmultiple, Inherited = inherited )]
Conditional
This predefined attribute marks a conditional method whose execution depends on a specified preprocessing identifier. It causes conditional compilation of method calls, depending on the specified value such as Debug or Trace.
The following is the syntax −
[Conditional( conditionalSymbol )]
Obsolete
This predefined attribute marks a program entity that should not be used. It enables you to inform the compiler to discard a particular target element. Here is the syntax −
[Obsolete ( message )] [Obsolete ( message, iserror )]
Advertisements