public override T Deserialize(Stream stream) { switch (underlyingTypeCode) { case TypeCode.Int64: case TypeCode.UInt64: var val64 = SimpleStreamUtil.ReadInt64(stream); return(EnumConvert.ToEnum64 <T>(val64)); default: var val = SimpleStreamUtil.Read7BitEncodedInt(stream); return(EnumConvert.ToEnum32 <T>(val)); } }
public override void Serialize(T obj, Stream stream) { switch (underlyingTypeCode) { case TypeCode.Int64: case TypeCode.UInt64: SimpleStreamUtil.Write(stream, EnumConvert.ToLong(obj)); break; default: SimpleStreamUtil.Write7BitEncodedInt(stream, EnumConvert.ToInt(obj)); break; } }