Google.Protobuf.EnumOptions.Deserialize C# (CSharp) Method

Deserialize() public static method

Takes the remaining content of the stream and deserialze it into the instance.
public static Deserialize ( Stream stream, Google instance ) : Google.Protobuf.EnumOptions
stream Stream
instance Google
return Google.Protobuf.EnumOptions
        public static Google.Protobuf.EnumOptions Deserialize(Stream stream, Google.Protobuf.EnumOptions instance)
        {
            instance.AllowAlias = true;
            if (instance.UninterpretedOption == null)
                instance.UninterpretedOption = new List<Google.Protobuf.UninterpretedOption>();
            while (true)
            {
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    break;
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 2 Varint
                    case 16:
                        instance.AllowAlias = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadBool(stream);
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    case 999:
                        if(key.WireType != global::SilentOrbit.ProtocolBuffers.Wire.LengthDelimited)
                            break;
                        // repeated
                        instance.UninterpretedOption.Add(Google.Protobuf.UninterpretedOption.DeserializeLengthDelimited(stream));
                        continue;
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }

Same methods

EnumOptions::Deserialize ( Stream stream ) : EnumOptions
EnumOptions::Deserialize ( byte buffer ) : EnumOptions
EnumOptions::Deserialize ( byte buffer, Google instance ) : Google.Protobuf.EnumOptions