// check if variable set or not if(variable != null) { Console.WriteLine("variable is set"); } else { Console.WriteLine("variable is not set"); variable = "This variable is now set"; }