2
Answers

Attributes in c#

Ask a question
Aaron Cronje

Aaron Cronje

12y
1.2k
1
Hi........

               I am doing a work in c# and define Attributes. How can we use attributes in c# and define its properties?

class BasicAttributeDemo
{
    [Obsolete]
    public void MyFirstdeprecatedMethod()
    {
        Console.WriteLine("Called MyFirstdeprecatedMethod().");
    }

    [ObsoleteAttribute]
    public void MySecondDeprecatedMethod()
    {
        Console.WriteLine("Called MySecondDeprecatedMethod().");
    }
In this code define [Obsolete ] what is the meaning of this variable? 


Answers (2)