Compiler Error CS0081
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#
// 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);
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: