C# Error CS0719 – ‘{0}’: array elements cannot be of static type

C# Error

CS0719 – ‘{0}’: array elements cannot be of static type

Reason for the Error & Solution

‘type’: array elements cannot be of static type

An array of static type does not make sense since array elements are instances, but it is not possible to create instances of static types.

The following sample generates CS0719:

// CS0719.cs  
public static class SC  
{  
   public static void F()  
   {  
   }  
}  
  
public class CMain  
{  
   public static void Main()  
   {  
      SC[] sca = new SC[10];  // CS0719  
   }  
}  

Leave A Reply

Your email address will not be published. Required fields are marked *

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...