|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Deserializing objectHi
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 "Søren M. Olesen" <smole***@hotmail.com> wrote in Maybe u can create a property "IsDeserialized" and flag the object during news:u12bD4C2GHA.1040@TK2MSFTNGP06.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 ?? > deserialization? Søren M. Olesen ha scritto:
> Hi How about this :> > 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 ?? <Serializable()> Class YourObject <nonserialized()> Public HasBeenNormallyInstantiated As Boolean = True 'Other properties ... End Class the flag HasBeenNormallyInstantiated will hold the answer because when deserialized will be false. Will be true when YourObject "normally" instantiated. Show quoteHide quote > > > TIA > > Søren Søren M. Olesen wrote:
> Hi Well yes... If you implement the ISerializable interface, then you> > 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 will have to add a constructor like: Public Sub New (ByVal info As SerializationInfo, ByVal context As StreamingContext) This constructor will be called when the object is deserialized. -- Tom Shelton Thanks a lot for all your replies, they have been very helpfull!!
Show quoteHide quote "Søren M. Olesen" <smole***@hotmail.com> wrote in message news:u12bD4C2GHA.1040@TK2MSFTNGP06.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 >
how to rollback a procedure (sqlserver) from VB2005?
EXE and Dev environment. Epson TM-T88 Drawer Kick string or StringBuilder return ? (newbie VB 2005 EE ) composing string from variables how to make base and derived class use the same member variable? Can we Read the text contents from PDF using .net Reflection, creating object with inherited cunstructor, how? Subtract Days from a Date How to licensce a .NET desktop application |
|||||||||||||||||||||||