public TV4Object GetV4Object <TV4Object>() where TV4Object : IV4Object, new() { SetInstance(); using (var stream = new MemoryStream(GetData(AW.Attributes.ObjectData))) { var serializer = new V4ObjectSerializer <TV4Object>(); return(serializer.Deserialize(stream)); } }
public void SetV4Object <TV4Object>(TV4Object v4Object) where TV4Object : IV4Object, new() { using (var stream = new MemoryStream()) { SetInstance(); var serializer = new V4ObjectSerializer <TV4Object>(); serializer.Serialize(stream, v4Object); var buffer = new byte[stream.Length]; stream.Position = 0; stream.Read(buffer, 0, buffer.Length); SetData(AW.Attributes.ObjectData, buffer); } }