AsmResolver.Net.Signatures.TypeSignature.ReadFieldOrPropType C# (CSharp) Method

ReadFieldOrPropType() public static method

public static ReadFieldOrPropType ( MetadataHeader header, IBinaryStreamReader reader ) : TypeSignature
header MetadataHeader
reader IBinaryStreamReader
return TypeSignature
        public static TypeSignature ReadFieldOrPropType(MetadataHeader header, IBinaryStreamReader reader)
        {
            var elementType = (ElementType)reader.ReadByte();
            switch (elementType)
            {
                case ElementType.Boxed:
                    return header.TypeSystem.Object;
                case ElementType.SzArray:
                    return new SzArrayTypeSignature(ReadFieldOrPropType(header, reader));
                case ElementType.Enum:
                    return FromAssemblyQualifiedName(header, reader.ReadSerString());
                default:
                    return MsCorLibTypeSignature.FromElementType(header, elementType);
            }
        }

Usage Example

Ejemplo n.º 1
0
        public static CustomAttributeNamedArgument FromReader(MetadataImage image, IBinaryStreamReader reader)
        {
            var signature = new CustomAttributeNamedArgument
            {
                ArgumentMemberType =
                    (reader.CanRead(sizeof(byte))
                        ? (CustomAttributeArgumentMemberType)reader.ReadByte()
                        : CustomAttributeArgumentMemberType.Field),
                ArgumentType = TypeSignature.ReadFieldOrPropType(image, reader),
                MemberName   = reader.ReadSerString(),
            };

            signature.Argument = CustomAttributeArgument.FromReader(image, signature.ArgumentType, reader);
            return(signature);
        }
All Usage Examples Of AsmResolver.Net.Signatures.TypeSignature::ReadFieldOrPropType