generics使用语句:使用ISet <> = System.Collections.Generic.ISet <>
由于我使用两个不同的通用集合命名空间( System.Collections.Generic和Iesi.Collections.Generic ),所以我有冲突。 在项目的其他部分,我使用的是nunit和mstest框架,但有资格,当我打电话Assert我想使用nunit版本 
 using Assert = NUnit.Framework.Assert; 
这很好,但我想用genericstypes做同样的事情。 但是,下面的行不起作用
 using ISet = System.Collections.Generic.ISet; using ISet<> = System.Collections.Generic.ISet<>; 
有谁知道如何告诉.net如何使用generics使用声明?
我认为你最好将别名命名空间自己进行别名,而不是generics(我认为这是不可能的)。
举个例子:
 using S = System.Collections.Generic; using I = Iesi.Collections.Generic; 
 然后,对于BCL ISet<int> ,例如: 
 S.ISet<int> integers = new S.HashSet<int>(); 
 不幸的是, using指令不会做你想要的。 你可以说: 
 using Frob = System.String; 
和
 using ListOfInts = System.Collections.Generic.List<System.Int32>; 
但是你不能说
 using Blob<T> = System.Collections.Generic.List<T> 
要么
  using Blob = System.Collections.Generic.List 
这是一个从来没有被纠正的语言的缺点。
你可以使用一个genericstypes的唯一方法就是按如下方式进行专门化。
 using IntSet = System.Collections.Generic.ISet<int>; 
您不能像在您的示例中那样对开放的generics进行别名:
 using MySet = System.Collections.Generic.ISet<>; 
 你的别名与类名本身是一样的,所以你仍然有歧义,就好像你有一个using每个名字空间。 给该类的别名一个不同的名字,即: 
 using FirstNamespace; using OtherObject = SecondNamespace.MyObject; public class Foo { public void Bar() { MyObject first = new MyObject;//will be the MyObject from the first namespace OtherObject second = new OtherObject; } } 
你可以给一个类别做别名:
 using Test = NameSpace.MyClass; 
只有当类不是通用的。
在某些情况下,你可以inheritance:
  public class MyList<T1, T2> : List<Tuple<IEnumerable<HashSet<T1>>, IComparable<T2>>> { } public void Meth() { var x = new MyList<int, bool>(); }