What does this mean []? Attributes?

  • Thread starter Thread starter needin4mation
  • Start date Start date
N

needin4mation

take this snippet from 4guysfromrolla:

namespace skmCalendar
{
[ ToolboxData("<{0}:HoverCalendar
runat=server></{0}:HoverCalendar>")]
public class HoverCalendar : System.Web.UI.WebControls.Calendar
{
[Bindable(true),
Category("Appearance"),
DefaultValue("")]
public Color HoverColor
{
get
{
....

What do the items in between the [] mean? Rather, what are they called
in C#? I can guess that Appearance will show up in the Properties in
VS (that is the property Appearance will be available), but I don't
knmow what the [ ] signature is called? Attributes, correct? Are they
C# constructs or ASP.NET constructs? Thank you for any help.
 
take this snippet from 4guysfromrolla:

namespace skmCalendar
{
[ ToolboxData("<{0}:HoverCalendar
runat=server></{0}:HoverCalendar>")]
public class HoverCalendar : System.Web.UI.WebControls.Calendar
{
[Bindable(true),
Category("Appearance"),
DefaultValue("")]
public Color HoverColor
{
get
{
...

What do the items in between the [] mean? Rather, what are they called
in C#? I can guess that Appearance will show up in the Properties in
VS (that is the property Appearance will be available), but I don't
knmow what the [ ] signature is called? Attributes, correct? Are they
C# constructs or ASP.NET constructs? Thank you for any help.

Yes, they're attributes, and they're C# constructs. They're used a lot
outside ASP.NET as well. In particular, almost every Windows Forms app
will have [STAThread] on the Main method.
 
Back
Top