How do I stop the designer from filling in my properties with null values?

Posted by Tim Gradwell on Stack Overflow See other posts from Stack Overflow or by Tim Gradwell
Published on 2010-06-05T22:26:11Z Indexed on 2010/06/05 22:52 UTC
Read the original article Hit count: 115

Filed under:
|
|

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;

© Stack Overflow or respective owner

Related posts about c#

Related posts about visual-studio