Beispiel #1
0
        public override void Parse(CLRMetaDataParser parser)
        {
            Type = (CLRSigType.ElementType)parser.ReadU8();
            if (parser.ReadU8() != 0)
                throw new ParseFailedException("Pad missing");

            Parent = parser.ReadHasConstant();
            Value = parser.ReadBlob();

            ICLRHasConstant hcParent = (ICLRHasConstant)Parent;
            CLRConstantRow[] newConstants;
            if (hcParent.AttachedConstants != null)
            {
                CLRConstantRow[] oldConstants = hcParent.AttachedConstants;
                newConstants = new CLRConstantRow[oldConstants.Length + 1];
                for (int i = 0; i < oldConstants.Length; i++)
                    newConstants[i] = oldConstants[i];
            }
            else
                newConstants = new CLRConstantRow[1];
            newConstants[newConstants.Length - 1] = this;
            hcParent.AttachedConstants = newConstants;
        }