public static EnumDescription Decode(Stream inputStream)
        {
            if (inputStream == null)
            {
                return(null);
            }
            EnumDescription instance = new EnumDescription();

            instance.DataTypeID = NodeID.Decode(inputStream);
            instance.Name       = QualifiedName.Decode(inputStream);
            int?arraySize = BaseType.ReadInt32(inputStream);

            if (!arraySize.HasValue)
            {
                return(null);
            }
            if (arraySize.Value < 0)
            {
                return(instance);
            }
            instance.Fields = new List <EnumField>(arraySize.Value + 1);
            for (int i = 0; i < arraySize.Value; i++)
            {
                instance.Fields.Add(EnumField.Decode(inputStream));
            }
            instance.Type = (BuiltinType)inputStream.ReadByte();
            return(instance);
        }