I was trying to compile the below code while i got the error. basically this error occur when you try to use a keyword as statement. you should make it statement for example in below code i have null as statement either you should assign null in a variable or write a statement. only null is not an statement.
to remove error replace
null;
to
str3 = null;
Now compile it will work.
C# Program With Error:
using System;
namespace MyApp
{
class my_class
{
static void Main(string[] args)
{
String str1 = "SoftwareTestingNet.com";
String str2 = "TestingWiz.com";
String str3;
if (str1 == str2)
{
Console.WriteLine("Equal.");
}
else
{
null;
}
Console.ReadLine();
}
}
}
Thanks. Got the error when declaring "params" as a var.
ReplyDelete