What's a Field in the .NET Framework?

  • Thread starter Thread starter Axel Dahmen
  • Start date Start date
A

Axel Dahmen

Hi,

I couldn't find any explanation on "Field" in MSDN. Can anyone please
enlighten me on what a Field is and what it distinguishes from a property? I
need this definition to decide when to use Type.GetField() and
Type.GetProperty(), respectively.

TIA,
Axel Dahmen
 
Axel said:
Hi,

I couldn't find any explanation on "Field" in MSDN. Can anyone please
enlighten me on what a Field is and what it distinguishes from a property? I
need this definition to decide when to use Type.GetField() and
Type.GetProperty(), respectively.

TIA,
Axel Dahmen

Hi Axel,

Bit difficult to find, I agree. Depends on how your mind works, but I
found it by MSDNing for GetField, then following the link to FieldInfo,
and found the following in the remarks:

"Fields are variables defined in the class. FieldInfo provides access
to the metadata for a field within a class and provides dynamic set and
get functionality for the field. The class is not loaded into memory
until invoke or get is called on the object"

So it's the actual variables you define within the class, which before
I found the FieldInfo description, was kindof what you can infer from
the example in GetField.

Damien
 
Thanks Damien, this was the information I've been looking for.

You're right, I actually didn't search in the remarks section but was
looking somewhere in the Framework Reference section for a definition of
Fields.

So, to put it in my words, "Fields" is another synonym for "class member
variable"?

Thank your for your help!! It's quite appreciated.

Regards,
Axel


------------
 
Back
Top