Is there any way (at all) that an object beign deserialized from a stream
can know (or figure out) that it has been created because of a deserialize
process rather than by a "normal" object instiantiation ??
"Søren M. Olesen" <smolesen@hotma il.comwrote in
news:u12bD4C2GH A.1040@TK2MSFTN GP06.phx.gbl:
Is there any way (at all) that an object beign deserialized from a
stream can know (or figure out) that it has been created because of a
deserialize process rather than by a "normal" object instiantiation ??
>
Maybe u can create a property "IsDeserialized " and flag the object during
deserialization ?
Hi
>
Is there any way (at all) that an object beign deserialized from a stream
can know (or figure out) that it has been created because of a deserialize
process rather than by a "normal" object instiantiation ??
How about this :
<Serializable() Class YourObject
<nonserialized( )Public HasBeenNormally Instantiated As Boolean =
True
'Other properties ...
End Class
the flag HasBeenNormally Instantiated will hold the answer because when
deserialized will be false. Will be true when YourObject "normally"
instantiated.
Hi
>
Is there any way (at all) that an object beign deserialized from a stream
can know (or figure out) that it has been created because of a deserialize
process rather than by a "normal" object instiantiation ??
>
>
TIA
>
Søren
Well yes... If you implement the ISerializable interface, then you
will have to add a constructor like:
Public Sub New (ByVal info As SerializationIn fo, ByVal context As
StreamingContex t)
This constructor will be called when the object is deserialized.
Thanks a lot for all your replies, they have been very helpfull!!
"Søren M. Olesen" <smolesen@hotma il.comwrote in message
news:u12bD4C2GH A.1040@TK2MSFTN GP06.phx.gbl...
>
Hi
>
Is there any way (at all) that an object beign deserialized from a stream
can know (or figure out) that it has been created because of a deserialize
process rather than by a "normal" object instiantiation ??
>
>
TIA
>
Søren
>
Comment