private static TypeSignature ReadTypeSignature(
MetadataImage image,
IBinaryStreamReader reader,
RecursionProtection protection)
{
var elementType = (ElementType)reader.ReadByte();
switch (elementType)
{
case ElementType.Array:
return(ArrayTypeSignature.FromReader(image, reader, protection));
case ElementType.Boxed:
return(BoxedTypeSignature.FromReader(image, reader, protection));
case ElementType.ByRef:
return(ByReferenceTypeSignature.FromReader(image, reader, protection));
case ElementType.CModOpt:
return(OptionalModifierSignature.FromReader(image, reader, protection));
case ElementType.CModReqD:
return(RequiredModifierSignature.FromReader(image, reader, protection));
case ElementType.Class:
return(TypeDefOrRefSignature.FromReader(image, reader, protection));
case ElementType.FnPtr:
return(FunctionPointerTypeSignature.FromReader(image, reader, protection));
case ElementType.GenericInst:
return(GenericInstanceTypeSignature.FromReader(image, reader, protection));
case ElementType.MVar:
return(GenericParameterSignature.FromReader(image, reader, GenericParameterType.Method));
case ElementType.Pinned:
return(PinnedTypeSignature.FromReader(image, reader, protection));
case ElementType.Ptr:
return(PointerTypeSignature.FromReader(image, reader, protection));
case ElementType.Sentinel:
return(SentinelTypeSignature.FromReader(image, reader, protection));
case ElementType.SzArray:
return(SzArrayTypeSignature.FromReader(image, reader, protection));
case ElementType.ValueType:
var type = TypeDefOrRefSignature.FromReader(image, reader, protection);
type.IsValueType = true;
return(type);
case ElementType.Var:
return(GenericParameterSignature.FromReader(image, reader, GenericParameterType.Type));
default:
return(MsCorLibTypeSignature.FromElementType(image, elementType));
}
}