表达式字符串无效

时间:2013-10-19 17:03:01

标签: c# if-statement compiler-errors

我想要

 Console.WriteLine("Please enter a day of the week, e.g. Tue: ");
 today =  Console.ReadLine();
 GotoWork = string (today != SUN && today != SAT) ?

              Console.WriteLine("You have to go to work today...") ; 
              Console.WriteLine("Ahh... the weekend. No work!");'

编译并告诉我是否需要去上班,但它告诉我'(今天!= SUN&& today!= SAT)'是

invalid expression term for string.

1 个答案:

答案 0 :(得分:0)

用双引号SUNSAT换行,因为这是表示字符串的方式。

today != "SUN" && today != "SAT"