Attributes control how a type or member interacts with the IDE, compiler, etc. Attributes themselves are classes. Take for example the System.ComponentModel.CategoryAttribute class. You apply it to a property declaration and it controls which category the property appears under in the Properties window at design time. Note that all attribute classes inherit the Attribute class, either directly or indirectly, and it is convention to end their name in "Attribute". When you apply an attribute in code you normally drop the "Attribute" suffix. For instance, this code:
Code:
using System;
using System.Collections.Generic;
using System.Text;
namespace WindowsApplication2
{
class MyTextBox : System.Windows.Forms.TextBox
{
private string _version = "1.0.0.0";
[System.ComponentModel.Category("Wunnell")]
public string Version
{
get { return _version; }
}
}
}
produced the result below when an instance of the class was added to a form in the designer.