protected void Load(IBinaryAccessor accessor) { int typeLength = accessor.ReadCompressedInteger(); string typeName = accessor.ReadString(typeLength, Encoding.UTF8); _type = TypeSignature.Parse(typeName, true) as TypeReference; if (_type == null) { throw new InvalidDataException(); } _type = (TypeReference)_type.Relocate(_module); accessor.ReadCompressedInteger(); // Blob size int argumentCount = accessor.ReadCompressedInteger(); _namedArguments = new CustomAttributeNamedArgumentCollection(this); _namedArguments.Load(accessor, argumentCount); }
protected void Load(IBinaryAccessor accessor) { // The encoded blob begins with the prolog, which is always the 2-byte value 0x0001. // This is actually the version of the custom attribute blob encoding scheme, which hasn't changed // since its introduction, so the prolog is the same for all existing versions of the runtime. short prolog = accessor.ReadInt16(); if (prolog != 1) { throw new CodeModelException(string.Format(SR.AssemblyLoadError, _module.Location)); } // Ctor arguments. _ctorArguments = new CustomAttributeCtorArgumentCollection(this); _ctorArguments.Load(accessor); // Named arguments. _namedArguments = new CustomAttributeNamedArgumentCollection(this); _namedArguments.Load(accessor); }