Compiler Error CS0718
'type': static types cannot be used as type arguments
Because a static type cannot be instantiated, it cannot be used as a generic argument. To resolve this error, remove the static type from the generic argument.
The following sample generates CS0718:
C#
// CS0718.cs
public static class SC
{
public static void F()
{
}
}
public class G<T>
{
}
public class CMain
{
public static void Main()
{
G<SC> gsc = new G<SC>(); // CS0718
}
}
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: