In this code snippet, we will take a look at attributes in C#.
Attributes are used to add additional information(metadata) to code. For example, you can use [class can be serialized. Or as I will demonstrate in the code example a method can be marked as obsolete and Visual Studio will warn you when you attempt to use the obsolete method.] to indicate that a
Note: You can even create your own custom attributes.
Let’s look at the code example below to see how to use attributes.
As you can see Visual Studio warns us that the method we are trying to invoke(call) is obsolete and displays the message we typed in earlier.