When you have a custom control and that you create a new property, say:
I have read that when using the custom control, whenever the value you will put in MyProperty, the IDE will generate a line of code because no ShouldSerializeMyProperty is present.
So the resulting IL will have some lines like
Get_Object
load string
Set_My Property
So I imagine that it is the benefits of the method, providing less code and so a IL code lighter and so more performant.
However, I have done the test with a custom object (deriving from TextBox) and my own property (like above) with its description and its default value. I hadn't changed that default value (so let it to 10 in the designer properties) and then check my generated code. No line for my property.
So.... Can someone explain me the role of the method ShouldSerializeProperties ?
Thanks
Thanks,
Visual Basic:
private m_MyProperty as Integer = 10
<Description("My New property"), DefaultValue(10)> _
public property MyProperty as integer
get
return m_MyProperty
end get
set(value as integer)
m_MyProperty = value
end set
end property
I have read that when using the custom control, whenever the value you will put in MyProperty, the IDE will generate a line of code because no ShouldSerializeMyProperty is present.
So the resulting IL will have some lines like
Get_Object
load string
Set_My Property
So I imagine that it is the benefits of the method, providing less code and so a IL code lighter and so more performant.
However, I have done the test with a custom object (deriving from TextBox) and my own property (like above) with its description and its default value. I hadn't changed that default value (so let it to 10 in the designer properties) and then check my generated code. No line for my property.
So.... Can someone explain me the role of the method ShouldSerializeProperties ?
Thanks
Thanks,