Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Cannot convert to static type 'type'
This error occurs if your code uses a cast to convert to a static type. Since it is not possible for an object to be an instance of a static type, casting to a static type can never be a meaningful cast.
The following sample generates CS0716:
// CS0716.cs
public static class SC
{
static void F() { }
}
public class Test
{
public static void Main()
{
object o = new object();
System.Console.WriteLine((SC)o); // CS0716
}
}
.NET feedback
.NET is an open source project. Select a link to provide feedback: