void IInternalObjectSerializer.Serialize(SerializationArchive archive) { if (archive.Version == 1) { archive.Write(Name); archive.Write(Next); } throw new VersionNotSupportedException(archive); }
public override void Serialize(SerializationArchive archive, GraphNode obj) { if (archive.Version == 1) { archive.Write(obj.Name); archive.Write(obj.Next); return; } throw new VersionNotSupportedException(archive); }
public new void Serialize(SerializationArchive archive) { archive.WriteBaseArchive(null); if (archive.Version == 1) { archive.Write(AnotherString); return; } throw new VersionNotSupportedException(archive); }
public override unsafe void Serialize(SerializationArchive archive, TestClassWithExternalObjectSerializer obj) { if (archive.Version == 1) { archive.Write(obj.BooleanFalse); archive.Write(obj.BooleanTrue); archive.Write(obj.Char); archive.Write(obj.SByte); archive.Write(obj.Byte); archive.Write(obj.Int16); archive.Write(obj.UInt16); archive.Write(obj.Int32); archive.Write(obj.UInt32); archive.Write(obj.Int64); archive.Write(obj.UInt64); archive.Write(obj.Single); archive.Write(obj.Double); archive.Write(obj.Decimal); archive.Write(obj.String); archive.Write(obj.DateTime); archive.Write(obj.DateTimeOffset); archive.Write(obj.Guid); archive.Write(obj.NonGenericType); archive.Write(obj.GenericTypeDefinition); archive.Write(obj.ClosedConstructedGenericType); archive.Write(obj.NullReference); archive.Write(obj.Enum_S8); archive.Write(obj.Enum_U8); archive.Write(obj.Enum_S16); archive.Write(obj.Enum_U16); archive.Write(obj.Enum_S32); archive.Write(obj.Enum_U32); archive.Write(obj.Enum_S64); archive.Write(obj.Enum_U64); archive.Write(obj.SerializableObject); // deserialize buffer via pointer archive.Write(obj.Buffer1.Length); fixed(byte *pBuffer = &obj.Buffer1[0]) archive.Write(pBuffer, obj.Buffer1.Length); // serializer buffer via stream archive.Write(obj.Buffer2.Length); archive.Write(new MemoryStream(obj.Buffer2)); return; } throw new VersionNotSupportedException(archive); }
public unsafe void Serialize(SerializationArchive archive) { if (archive.Version == 1) { archive.Write(BooleanFalse); archive.Write(BooleanTrue); archive.Write(Char); archive.Write(SByte); archive.Write(Byte); archive.Write(Int16); archive.Write(UInt16); archive.Write(Int32); archive.Write(UInt32); archive.Write(Int64); archive.Write(UInt64); archive.Write(Single); archive.Write(Double); archive.Write(Decimal); archive.Write(String); archive.Write(DateTime); archive.Write(DateTimeOffset); archive.Write(Guid); archive.Write(NonGenericType); archive.Write(GenericTypeDefinition); archive.Write(ClosedConstructedGenericType); archive.Write(NullReference); archive.Write(Enum_S8); archive.Write(Enum_U8); archive.Write(Enum_S16); archive.Write(Enum_U16); archive.Write(Enum_S32); archive.Write(Enum_U32); archive.Write(Enum_S64); archive.Write(Enum_U64); archive.Write(SerializableObject); // serialize buffer via pointer archive.Write(Buffer1.Length); fixed(byte *pBuffer = &Buffer1[0]) archive.Write(pBuffer, Buffer1.Length); // serializer buffer via stream archive.Write(Buffer2.Length); archive.Write(new MemoryStream(Buffer2)); return; } throw new VersionNotSupportedException(archive); }