This documentation is archived and is not being maintained.

Compiler Error CS0307 

Error Message

The 'construct' 'identifier' cannot be used with type arguments

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;
   }
}
Show: