Have you failed a job interview?
Send us your job interview questions and get correct answers.

What is an attribute in C#?

Experience Level: Junior
Tags: C#


  • In C#, an attribute is like a tag using which you can add additional information to a class or method.
  • The attribute is applied to a class or method by writing the attribute name into the square brackets before the class or method definition.
  • In the example below you can see how the attribute Test is applied to the class Verification and attribute Obsolete is applied to the method MyMethod.
namespace House 
  class Verification 
    public static void MyMethod()


No Comments Yet.
Be the first to tell us what you think.
C# for beginners
C# for beginners

Are you learning C# ? Try our test we designed to help you progress faster.

Test yourself