By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,896 Members | 2,002 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,896 IT Pros & Developers. It's quick & easy.

What does this mean []? Attributes?

P: n/a
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.

Sep 27 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
They are language ("C#") constructs, and are used throughout the .NET
Framwork. An Attribute is just another kind of class:

http://msdn2.microsoft.com/en-us/lib...attribute.aspx

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ne***********@gmail.com" wrote:
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.

Sep 27 '06 #2

P: n/a
<ne***********@gmail.comwrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Sep 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.