public static EntityHandle GetGenericType()

in src/Refasmer/Utils/MetaUtil.cs [41:59]


    public static EntityHandle GetGenericType( this MetadataReader reader, TypeSpecificationHandle typeSpecHandle ) =>
        reader.GetGenericType(reader.GetTypeSpecification(typeSpecHandle));

    public static EntityHandle GetGenericType( this MetadataReader reader, TypeSpecification typeSpec )
    {
        var blobReader = reader.GetBlobReader(typeSpec.Signature);

        var typeCode = blobReader.ReadCompressedInteger();

        if (typeCode != (int) SignatureTypeCode.GenericTypeInstance)
            return default;

        typeCode = blobReader.ReadCompressedInteger();

        if (typeCode != (int) SignatureTypeKind.Class && typeCode != (int) SignatureTypeKind.ValueType)
            return default;

        return blobReader.ReadTypeHandle();
    }