Hello everyone,
I am rather new to .net. I've been struggling with the basics: C# terminology.
Can anyone help me to get what is the difference among these terms, i.e. 'field', 'property' and 'attribute'?
The reason for asking is that some sources use them as synonyms, others deliberately avoid using 'attribute' or 'property' etc.
Seems a mess. The MSDN glossary is not helpful either.
My present understanding is:
- field: the component of a class. Describes the class: what does the class look like, what are its characteristics etc.
- attribute: a special tag that marks a field. There most of the confusion comes: what sort of tags? Where they can be put? What do they mean?
- property: a special method that manages access to fields (which in turn should always be private); is marked by 'set' and 'get' key words.
Is it correct?
Thanks in advance
I am rather new to .net. I've been struggling with the basics: C# terminology.
Can anyone help me to get what is the difference among these terms, i.e. 'field', 'property' and 'attribute'?
The reason for asking is that some sources use them as synonyms, others deliberately avoid using 'attribute' or 'property' etc.
Seems a mess. The MSDN glossary is not helpful either.
My present understanding is:
- field: the component of a class. Describes the class: what does the class look like, what are its characteristics etc.
- attribute: a special tag that marks a field. There most of the confusion comes: what sort of tags? Where they can be put? What do they mean?
- property: a special method that manages access to fields (which in turn should always be private); is marked by 'set' and 'get' key words.
Is it correct?
Thanks in advance