I was writing a class in c#.
I stumbled upon the this piece of suggestion offered by a code refactor. And i didnt
get what exactly the tool meant when it offered this suggestion/improvement.
Situation :
I was using this.Text property to set the title in the constructor of my Form class.
Form()
{
//some initialization code ...
//...
this.Text = "Non modal form"; //Suggestion offered here..
}
The code refactor tool prompted a warning : saying accessing virtual member
To correct this the tool automatically added a property
public override sealed string Text
{
get { return base.Text; }
set { base.Text = value; }
}
Can anyone explain me how, adding a sealed property will affect/improve the situation.
Cheers