M
Manoj Gokhale
Guest
Hello
I had a doubt as to why the following code is a bad programming style . It is from MSDN Documentation
It is a bad programming style to change the state of the object by using the get accessor. For example, the following accessor produces the side effect of changing the state of the object every time that the number field is accessed.
private int number;
publicint Number
{
get
{
return number++; // Don't do this
}
}
regards
Manoj Gokhale
Continue reading...
I had a doubt as to why the following code is a bad programming style . It is from MSDN Documentation
It is a bad programming style to change the state of the object by using the get accessor. For example, the following accessor produces the side effect of changing the state of the object every time that the number field is accessed.
private int number;
publicint Number
{
get
{
return number++; // Don't do this
}
}
regards
Manoj Gokhale
Continue reading...