Reputation: 2412
When I add a control to a form, visual studio assigns various of the properties of that form a value of null in the auto-generated designer code.
I don't want the designer to make the redundant assignment (the value is already null).
Can anyone tell me how to prevent it?
example
MyControl has property
public SomeClass MyProperty
{
get { return m_MyValue; }
set { m_MyValue = value; }
}
designer then autogenerates the following:
myControl1.MyProperty = null;
Upvotes: 2
Views: 345
Reputation: 180868
myControl1.MyProperty = null;
and the setting in the designer are the same thing.
If you change the value for the setting in the line of code, then go to the designer, and you will see that the value has changed in the designer also. Similarly, if you change the value in the designer, the value in the code will change.
Upvotes: 0