Save/Load Date To BinaryStream

Hello everyone,

i created a Superclass e.g. Foo. Every Foo has a Date-Property “Created” and “Modified”. Ich would like to save those Date within a BinaryStream. Tried this:
[h]Save[/h]

s.WriteText(Created.SQLDateTime)

[h]Load[/h]

b = ParseDate(s.ReadText, fCreated)

another option was

fCreated.SQLDateTime = s.ReadText

[h]Helpers[/h]

Function WriteText(Extrends s As BinaryStream, Text As String) Dim aString As String = ConvertEncoding(Text, Encodings.UTF8) s.LittleEndian = False s.WriteLong(LenB(aString)) s.Write aString End

Function ReadText(Extends s As BinaryStream) as String s.LittleEndian = False Dim l As Integer = s.ReadLong Return s.Read(l, Encodings.UTF8) End

But it will not work…Any Ideas?

Best regards

The second version (assigning directly to SQLDateTime) will work.

BTW, your methods are sort of recreating the TextOutputStream and TextInputStream. Wouldn’t those be more appropriate here?

That’s hilarious.

Ah, i found the bug. I forget at the subclass to call the constructor with Super.Constructor :wink: