This documentation is archived and is not being maintained.

Compiler Error CS0081 

Error Message

Type parameter declaration must be an identifier not a type

When you declare a generic method or type, specify the type parameter as an identifier, for example "T" or "inputType". When client code calls the method, it supplies the type, which replaces each occurrence of the identifier in the method or class body. For more information, see Generic Type Parameters (C# Programming Guide).

// CS0081.cs
class MyClass
{
   public void F<int>() {}   // CS0081
   public void F<T>(T input) {}   // OK

   public static void Main()
   {
      MyClass a = new MyClass();
      a.F<int>(2);
      a.F<double>(.05);
   }
}

See Also

Show: