Skip to main content

Posts

Showing posts from July, 2010

Shouldserialize

Whats  Shouldserialize?
Shouldserialize is an optional method that you can provide for a property, if the property does not have a simple default value.
Why I used this in my project  In  fortnight period, some projects broken several times because,  some properties defined as nullable and do not have any default value. So while you creating a property if it do not have any default value or  is nullable, please use the service of shouldserilaize optional method J.
Example:-

Property:-                 Public _MyCar As Nullable(Of String) = Nothing _ Public Property MyCar() As Nullable(Of String) Get Return _MyCar End Get Set(ByVal value As Nullable(Of String)) _MyCar = value End Set End PropertyShould Serilalize method:- Public Function ShouldSerializeMyCar() As Boolean Return (MyCar.HasValue) End FunctionNaming concept is ShouldSerialize followed by property nameMore Det…