Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0694 

Error Message

Type parameter 'identifier' has the same name as the containing type, or method

You must use a different name for the type parameter since the type parameter's name cannot be identical to the type or method name that contains the type parameter.

Example

The following sample generates CS0694.

// CS0694.cs
// compile with: /target:library
class C<C> {}   // CS0694

In addition to the above case involving a generic class, this error may occur with a method:

// CS0694_2.cs
// compile with: /target:library
class A
{
   public void F<F>(F arg);   // CS0694
}

Community Additions

ADD
Show:
© 2015 Microsoft