|
In fact, there are no essential differences between attributes, fields, and member variables.
Fields can also be declared as public, readonly, or other
However, attributes generally add an access restriction on the basis of the field and can also make the field a smart field.You can do some extra things when getting or setting the field value:
private int t;
public int T
{
set {
if (value .... // determine if value meets certain conditions
{
T = value;
}
else ....
}
get {...}
} |
|