/// <summary>
        /// Reads a single property signature from an input stream.
        /// </summary>
        /// <param name="module">The module containing the signature.</param>
        /// <param name="reader">The blob input stream.</param>
        /// <param name="protection">The object responsible for detecting infinite recursion.</param>
        /// <returns>The property signature.</returns>
        public static PropertySignature FromReader(ModuleDefinition module, IBinaryStreamReader reader,
                                                   RecursionProtection protection)
        {
            var attributes = (CallingConventionAttributes)reader.ReadByte();

            if ((attributes & CallingConventionAttributes.Property) == 0)
            {
                throw new FormatException("Input stream does not point to a valid property signature.");
            }

            var result = new PropertySignature(attributes);

            result.ReadParametersAndReturnType(module, reader, protection);
            return(result);
        }
示例#2
0
        /// <inheritdoc />
        public bool Equals(CallingConventionSignature x, CallingConventionSignature y)
        {
            if (ReferenceEquals(x, y))
            {
                return(true);
            }
            if (ReferenceEquals(x, null) || ReferenceEquals(y, null))
            {
                return(false);
            }

            return(x switch
            {
                LocalVariablesSignature localVarSig => Equals(localVarSig, y as LocalVariablesSignature),
                FieldSignature fieldSig => Equals(fieldSig, y as FieldSignature),
                MethodSignature methodSig => Equals(methodSig, y as MethodSignature),
                PropertySignature propertySig => Equals(propertySig, y as PropertySignature),
                _ => false
            });