public static CustomAttributeArgument FromReader(MetadataHeader header, TypeSignature typeSignature, IBinaryStreamReader reader)
        {
            var signature = new CustomAttributeArgument()
            {
                ArgumentType = typeSignature
            };

            if (typeSignature.ElementType != ElementType.SzArray)
            {
                signature.Elements.Add(ElementSignature.FromReader(header, typeSignature, reader));
            }
            else
            {
                var arrayType = ((SzArrayTypeSignature)typeSignature).BaseType;

                var elementCount = reader.CanRead(sizeof(uint)) ? reader.ReadUInt32() : uint.MaxValue;
                if (elementCount != uint.MaxValue)
                {
                    for (uint i = 0; i < elementCount; i++)
                    {
                        signature.Elements.Add(ElementSignature.FromReader(header, arrayType, reader));
                    }
                }
            }

            return(signature);
        }
 public CustomAttributeArgument(TypeSignature argumentType, ElementSignature value)
     : this(argumentType, new[] { value })
 {
 }
Пример #3
0
 public CustomAttributeArgument(TypeSignature argumentType, ElementSignature value)
     : this(argumentType, new[] { value })
 {
 }