HomeCSharpC# Error CS0721 – ‘{0}’: static types cannot be used as parameters

C# Error CS0721 – ‘{0}’: static types cannot be used as parameters

C# Error

CS0721 – ‘{0}’: static types cannot be used as parameters

Reason for the Error & Solution

‘type’: static types cannot be used as parameters

A static type is not meaningful as a parameter. Since no instances of static types may be created, no instance could ever be passed as a parameter.

The following sample generates CS0721:

// CS0721.cs  
public static class SC  
{  
}  
  
public class CMain  
{  
   public void F(SC sc)  // CS0721  
   {  
   }  
  
   public static void Main()  
   {  
   }  
}  

Leave a Reply

You May Also Like

This C# program calculates and displays an upper triangular matrix based on user input. Problem Statement: The program takes the...
This C# program serves as a demonstration of bitwise operators, which are fundamental operators used for manipulating individual bits in...
This C# program is designed to interchange or swap the columns of a matrix. A matrix is a two-dimensional array...