小编prx*_*prx的帖子

如何确定两个对象的类型是否兼容?

我有一个通用的功能,我想知道如何写.

List<Something> something;

public int countItems<T>(List<T> Items)
{
    // Here I would like to compare the type of "Items" with the type of "something" to see if they are compatible. How do I do it?
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c# generics comparison types compare

2
推荐指数
1
解决办法
1572
查看次数

标签 统计

c# ×1

compare ×1

comparison ×1

generics ×1

types ×1