public static PriorityValue Load(IValueStream stream) { PriorityValue ret = null; Tags tag = (Tags)stream.EnterChoice(); switch (tag) { case Tags.Null: ret = Value <NullWrapper> .Load(stream); break; case Tags.Real: ret = Value <RealWrapper> .Load(stream); break; case Tags.Binary: ret = Value <BinaryWrapper> .Load(stream); break; case Tags.Integer: ret = Value <IntegerWrapper> .Load(stream); break; case Tags.ConstructedValue: ret = Value <ConstructedValueWrapper> .Load(stream); break; default: throw new Exception(); } stream.LeaveChoice(); return(ret); }
public static void Save(IValueSink sink, PriorityValue value) { sink.EnterChoice((byte)value.Tag); switch(value.Tag) { case Tags.Null: Value<NullWrapper>.Save(sink, (NullWrapper)value); break; case Tags.Real: Value<RealWrapper>.Save(sink, (RealWrapper)value); break; case Tags.Binary: Value<BinaryWrapper>.Save(sink, (BinaryWrapper)value); break; case Tags.Integer: Value<IntegerWrapper>.Save(sink, (IntegerWrapper)value); break; case Tags.ConstructedValue: Value<ConstructedValueWrapper>.Save(sink, (ConstructedValueWrapper)value); break; default: throw new Exception(); } sink.LeaveChoice(); }