C# 泛型多种参数类型与多重约束 示例

C# 泛型多种参数类型与多重约束 示例

1
2
3
4
5
6
7
8
9
10
11
12
interface IMyInterface
{
}
 
class Dictionary<TKey, TVal>
    where TKey : IComparable, IEnumerable
    where TVal : IMyInterface
{
    public void Add(TKey key, TVal val)
    {
    }
}
posted @ 2017-07-16 23:17  三页菌  阅读(1484)  评论(0编辑  收藏  举报