ShouldSerialize and method in WebControl

V

Victor Irzak

Hello,

Why doesn't ShouldSerialise Method work in WebControl?
What is the best way to control the which attributes are serialized and
which once aren't
DefaultValue attribute in not enough.

Thanks

Victor
 
J

John Saunders

Victor Irzak said:
Hello,

Why doesn't ShouldSerialise Method work in WebControl?
What is the best way to control the which attributes are serialized and
which once aren't
DefaultValue attribute in not enough.

How about
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]?
 
V

Victor Irzak

That's not enough either.

I'd like to decide whether to serialize an attribute based on other members
of the class.
DesignerSerializationVisibility and DefaultValue can't do that while
ShouldSerialize does, but works only with winforms.




John Saunders said:
Victor Irzak said:
Hello,

Why doesn't ShouldSerialise Method work in WebControl?
What is the best way to control the which attributes are serialized and
which once aren't
DefaultValue attribute in not enough.

How about
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]?
 
W

WALDO

ShouldSerialize works

[VB.Net]

Private _myProperty As String = "[Default Value]"
Public Property MyProperty As String
Get
Return Me._myProperty
End Get
Set(Value As String)
Me._myProperty = Value
End Set
End Property

Private Function ShouldSerializeMyProperty As Boolean
Return CBool(Me._myProperty <> "[Default Value]")
End Function


Victor Irzak said:
That's not enough either.

I'd like to decide whether to serialize an attribute based on other members
of the class.
DesignerSerializationVisibility and DefaultValue can't do that while
ShouldSerialize does, but works only with winforms.




John Saunders said:
Victor Irzak said:
Hello,

Why doesn't ShouldSerialise Method work in WebControl?
What is the best way to control the which attributes are serialized and
which once aren't
DefaultValue attribute in not enough.

How about
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top