At 4:41 PM +0100 2/27/04, Paolo Molaro wrote:On 02/27/04 Dan Sugalski wrote:[...]> What .NET calls an attribute parrot calls a property > What .NET calls a property parrot calls an attribute> The .NET reversal's just the big nasty one.Oh, yeah. No matter which way we go we'll be confusing someone, since there are languages that call what we call an attribute an attribute.
[Paolo's property and attribute for .net explanation snipped]
Okay, now I'm *really* confused. This seems to contradict the explanations in the "C# in a Nutshell" book, assuming that C# and .NET use the same underlying terminology. OTOH I could be misreading the book, and OTTH I'd be foolish to not take Paolo's explanation as most correct. I think I may well just chop out part of the glossary.
I swear, I'm going to rename these things to Fred and Barney and not tell anyone which is which...
Ordered by ascending esotericism:
Fields: Class data members. Properties: Syntactic sugar for getter and setter methods. Attributes: Extensible metadata for compile-time objects.
In context:
using System; using ICLUBcentral.Testing; namespace ICLUBcentral.Example { class Eg { // This is a field: private int _num; // This is a property: public int Num { get { return _num; } set { _num = value; } } [TestCase(2)] // <-- This is an attribute. private void _TestNum() { Test.OK(Num == 0, "default value"); Num = 43; Test.OK(Num == 43, "changed value"); } } }
I have a program which will load the resultant DLL and run all methods which have a TestCase attribute applied to them.
Am very, very sure of this terminology.
—
Gordon Henriksen [EMAIL PROTECTED]