Пример #1
0
            public static TestType Load(IValueStream stream)
            {
                stream.EnterSequence();
                var nullValue     = stream.GetNull();
                var booleanValue  = stream.GetBoolean();
                var optionalValue = Value <Option <byte> > .Loader(stream);

                var         choice      = stream.EnterChoice();
                ITestChoice choiceValue = null;

                switch (choice)
                {
                case 0:
                    choiceValue = FloatChoice.Load(stream);
                    break;

                case 1:
                    choiceValue = DoubleChoice.Load(stream);
                    break;

                case 2:
                    choiceValue = StringChoice.Load(stream);
                    break;
                }
                stream.LeaveChoice();

                var arrayValue = ReadOnlyArray <ushort> .Load(stream);

                return(new TestType(nullValue, booleanValue, optionalValue, choiceValue, arrayValue));
            }
Пример #2
0
            public static TestType Load(IValueStream stream)
            {
                stream.EnterSequence();
                var nullValue = stream.GetNull();
                var booleanValue = stream.GetBoolean();
                var optionalValue = Value<Option<byte>>.Loader(stream);

                var choice = stream.EnterChoice();
                ITestChoice choiceValue = null;
                switch (choice)
                {
                    case 0:
                        choiceValue = FloatChoice.Load(stream);
                        break;
                    case 1:
                        choiceValue = DoubleChoice.Load(stream);
                        break;
                    case 2:
                        choiceValue = StringChoice.Load(stream);
                        break;
                }
                stream.LeaveChoice();

                var arrayValue = ReadOnlyArray<ushort>.Load(stream);

                return new TestType(nullValue, booleanValue, optionalValue, choiceValue, arrayValue);
            }