C# terminology: attribute versus field

  • Thread starter Thread starter Neil Zanella
  • Start date Start date
N

Neil Zanella

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
 
Neil Zanella said:
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.
 
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
 
Daniel O'Connell said:
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".
 
Back
Top