Compiler Error CS0307
The 'construct' 'identifier' is not a generic method. If you intended an expression list, use parentheses around the < expression.
The construct named was not a type or a method, the only constructs that can take generic arguments. Remove the type arguments in angle brackets. If a generic is needed, declare your generic construct as a generic type or method.
The following sample generates CS0307:
// CS0307.cs
class C
{
public int P { get { return 1; } }
public static void Main()
{
C c = new C();
int p = c.P<int>(); // CS0307 – C.P is a property
// Try this instead
// int p = c.P;
}
}
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: