HomeCSharpC# Error CS1025 – Single-line comment or end-of-line expected

C# Error CS1025 – Single-line comment or end-of-line expected

C# Error

CS1025 – Single-line comment or end-of-line expected

Reason for the Error & Solution

Single-line comment or end-of-line expected

A line with a cannot have a multiline comment.

The following sample generates CS1025:

#if true /* hello  
*/   // CS1025  
#endif   // this is a good comment  

CS1025 could also occur if you attempt some invalid preprocessor directive, as follows:

// CS1025.cs  
#define a  
  
class Sample  
{  
   static void Main()  
   {  
      #if a 1   // CS1025, invalid syntax  
         System.Console.WriteLine("Hello, World!");  
      #endif  
   }  
}  

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