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

C# terminology: attribute versus field

P: n/a
Hello,

I would like to ask a question pertaining to some C# terminology. My reference
book says that within a class, attributes are the same as fields. I would like
to know what the standard stays with regards to this terminology. According to
the ECMA C# standard, what is the difference between attribute and field.

Thank you for your clarifications,

Regards,

Neil
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"Neil Zanella" <nz******@gmail.com> wrote in message
news:1a*************************@posting.google.co m...
Hello,

I would like to ask a question pertaining to some C# terminology. My
reference
book says that within a class, attributes are the same as fields. I would
like
to know what the standard stays with regards to this terminology.
According to
the ECMA C# standard, what is the difference between attribute and field.


The spec says that fields are variables associated with a class and that
attributes are declarative peices of information associated with the class.

Fields: http://www.jaggersoft.com/csharp_standard/8.7.2.htm
Attributes: http://www.jaggersoft.com/csharp_standard/8.14.htm

I believe fields and attributes are used interchangably in some languages
and books, but the spec does not do so. It clearly defines each.
Nov 16 '05 #2

P: n/a
Neil,

Be aware that this is as long as it is inside C# this does not mean that
that is directly a definition for the terminology when used with C# in a
database or by instance HTML.

Daniel,

Thanks for the link from me as well, good information, looks great

Cor
Nov 16 '05 #3

P: n/a

"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:uh****************@TK2MSFTNGP15.phx.gbl...

"Neil Zanella" <nz******@gmail.com> wrote in message
news:1a*************************@posting.google.co m...
Hello,

I would like to ask a question pertaining to some C# terminology. My
reference
book says that within a class, attributes are the same as fields. I would
like
to know what the standard stays with regards to this terminology.
According to
the ECMA C# standard, what is the difference between attribute and field.


The spec says that fields are variables associated with a class and that
attributes are declarative peices of information associated with the
class.

Fields: http://www.jaggersoft.com/csharp_standard/8.7.2.htm
Attributes: http://www.jaggersoft.com/csharp_standard/8.14.htm

I believe fields and attributes are used interchangably in some languages
and books, but the spec does not do so. It clearly defines each.


"Attribute" is general OO terminolgy, not used in any of the common
C++-derived langagues. C# and Java calls them "fields", while c++ uses
"member variables".
Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.