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

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

interface IMyInterface
{
}

class Dictionary<TKey, TVal>
    where TKey : IComparable, IEnumerable
    where TVal : IMyInterface
{
    public void Add(TKey key, TVal val)
    {
    }
}

  

posted @ 2016-10-13 09:30  沐汐Vicky  阅读(6210)  评论(1编辑  收藏  举报