} // Read

        public static uint Read(this NativeReader reader, uint offset, out TypeSpecificationHandle handle)
        {
            uint value;
            offset = reader.DecodeUnsigned(offset, out value);
            handle = new TypeSpecificationHandle((int)value);
            handle._Validate();
            return offset;
        } // Read
        } // Read

        public static uint Read(this NativeReader reader, uint offset, out TypeSpecificationHandle[] values)
        {
            uint count;
            offset = reader.DecodeUnsigned(offset, out count);
            if (count == 0)
            {
                values = s_emptyTypeSpecificationHandleArray;
            }
            else
            {
                values = new TypeSpecificationHandle[count];
                for (uint i = 0; i < count; ++i)
                {
                    TypeSpecificationHandle tmp;
                    offset = reader.Read(offset, out tmp);
                    values[i] = tmp;
                }
            }
            return offset;
        } // Read
        } // IsNull

        internal bool IsNull(TypeSpecificationHandle handle)
        {
            return (handle._value & 0x00FFFFFF) == 0;
        } // IsNull
        } // ToHandle

        internal Handle ToHandle(TypeSpecificationHandle handle)
        {
            return new Handle(handle._value);
        } // ToHandle
        } // GetTypeReference

        public TypeSpecification GetTypeSpecification(TypeSpecificationHandle handle)
        {
            var record = new TypeSpecification() { _reader = this, _handle = handle };
            var offset = (uint)handle.Offset;
            offset = _streamReader.Read(offset, out record._signature);
            offset = _streamReader.Read(offset, out record._customAttributes);
            return record;
        } // GetTypeSpecification
        } // Equals

        public bool Equals(TypeSpecificationHandle handle)
        {
            return _value == handle._value;
        } // Equals
        } // Read

        public static uint Read(this NativeReader reader, uint offset, out TypeSpecificationHandle[] values)
        {
            uint count;
            offset = reader.DecodeUnsigned(offset, out count);
            #if !NETFX_45
            if (count == 0)
            {
                values = Array.Empty<TypeSpecificationHandle>();
            }
            else
            #endif
            {
                values = new TypeSpecificationHandle[count];
                for (uint i = 0; i < count; ++i)
                {
                    TypeSpecificationHandle tmp;
                    offset = reader.Read(offset, out tmp);
                    values[i] = tmp;
                }
            }
            return offset;
        } // Read