HomeCSharpC# Error CS1028 – Unexpected preprocessor directive

C# Error CS1028 – Unexpected preprocessor directive

C# Error

CS1028 – Unexpected preprocessor directive

Reason for the Error & Solution

Unexpected preprocessor directive

A was found but not expected.

For example, a #endif was found with no preceding #if.

The following sample generates CS1028:

// CS1028.cs  
#endif   // CS1028, no matching #if  
namespace x  
{  
   public class clx  
   {  
      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...