Hi All,
I'm wondering what benefits this code has:
private int _TestID;
public int TestID
{
get
{
return _TestID;
}
set
{
if(_TestID != value)
{
_TestID = value;
}
}
}
vs. this:
private int _TestID;
public int TestID
{
get
{
return _TestID;
}
set
{
_TestID = value;
}
}
It seems to me that this was done in the name of efficiency (only setting if different), but wouldn't the test take as long (or longer) that the initial set? I'm not sure if I'm missing something here, but would love to hear any comments and explanations.