编译器警告(等级 3)CS0693
更新:2007 年 11 月
错误消息
类型参数“type parameter”与外部类型“type”中的类型参数同名
当具有泛型成员(例如泛型类中的方法)时将发生此错误。方法的类型参数不一定与类的类型参数相同,因此不能为它们指定相同的名称。有关更多信息,请参见泛型方法(C# 编程指南)。
若要避免这种情况,请对其中一个类型参数使用其他名称。
示例
下面的示例生成 CS0693。
// CS0693.cs
// compile with: /W:3 /target:library
class Outer<T>
{
class Inner<T> {} // CS0693
// try the following line instead
// class Inner<U> {}
}