F
Flipje
In my view, there is a major drawback to using attributes: the getter and
the setter have identical protection levels. But I usually want the getter
to be public and the setter to be protected or even private.
Example: I would have liked this to be possible:
int Thingy
{
public get { return mThingy; }
private set { mThingy = value; }
}
Unfortunately, it isn't. So now, instead of attributes, I use good old
GetThingy () and SetThingy () functions. I've been trying to find a decent
discussion about the subject, but it seems like I'm the only one who sees
having identical protection levels as a problem. So, am I missing something?
Is there some way to make attributes work the way I want?
the setter have identical protection levels. But I usually want the getter
to be public and the setter to be protected or even private.
Example: I would have liked this to be possible:
int Thingy
{
public get { return mThingy; }
private set { mThingy = value; }
}
Unfortunately, it isn't. So now, instead of attributes, I use good old
GetThingy () and SetThingy () functions. I've been trying to find a decent
discussion about the subject, but it seems like I'm the only one who sees
having identical protection levels as a problem. So, am I missing something?
Is there some way to make attributes work the way I want?