From: Rodrigo B. de O. <rod...@gm...> - 2004-10-29 00:30:26
|
Something along the following lines if I recall our conversation correctly: <snip> import System import System.IO import System.Runtime.Serialization import System.Runtime.Serialization.Formatters.Binary class Person: [property(FirstName)] _fname = "" [property(LastName)] _lname = "" class PersonProxy(Person, ISerializable): transient _caboosh = 0 def constructor(): pass def constructor(info as SerializationInfo, context as StreamingContext): data = info.GetValue("Person.Data", typeof((object))) FormatterServices.PopulateObjectMembers(self, GetSerializableMembers(), data) def GetObjectData(info as SerializationInfo, context as StreamingContext): members = GetSerializableMembers() info.AddValue("Person.Data", FormatterServices.GetObjectData(self, members)) def GetSerializableMembers(): return FormatterServices.GetSerializableMembers(Person) def serialize(o): stream = MemoryStream() BinaryFormatter().Serialize(stream, o) return stream.GetBuffer() def deserialize(buffer as (byte)): return BinaryFormatter().Deserialize(MemoryStream(buffer)) p = PersonProxy(FirstName: "John", LastName: "Cleese") p = deserialize(serialize(p)) assert "John" == p.FirstName assert "Cleese" == p.LastName </snip> cheers, Rodrigo On Thu, 28 Oct 2004 21:06:20 -0700, hammett <ha...@uo...> wrote: > Hiya, > > I was talking to bamboo today and thinking about this problem. One possible > solution suggested by him relies on the use of FormatterServices. > > Henry, can you please check this out? > > -- > Cheers, > hammett > http://www.digitalcraftsmen.com.br/~hammett > > ------------------------------------------------------- > This Newsletter Sponsored by: Macrovision > For reliable Linux application installations, use the industry's leading > setup authoring tool, InstallShield X. Learn more and evaluate > today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/ > _______________________________________________ > Aspectsharp-users mailing list > Asp...@li... > https://lists.sourceforge.net/lists/listinfo/aspectsharp-users > -- bamboo http://blogs.codehaus.org/people/bamboo/ |