Click to See Complete Forum and Search --> : Attribute vs Property


yemiu
November 23rd, 2004, 08:09 PM
Hi there,
I am wondering the differences between using Attribute and Property. Let me tell what I understand so far:
1. Attribute: this is a class, can be used to add metadata (description) of an element (could be anything such as class, methods, constructors, fields) to the assembly at the compilation time.
We can use Reflection to retrieve metadata stored in the attributes.

2. Properties: fields inside a class, or a struct. Can be used only to describe a class/object (more limitted than attributes, property does not describe methods, fields, ...).

I cant think of anything else. Also can some one please tell me when we use attributes?
Thanks
Pat