Edit

Share via


Compiler Error CS0694

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 1

The following sample generates CS0694.

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

Example 2

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  
}