面试题如下:完成如下代码,使其输出“Hello World!”

using System;
using System.Collections.Generic;
using System.Linq; using System.Text;
namespace HelloWorld
{
       class Program
          {
                static void Main(string[] args)
                      {
                          if (/* 补充这里 */)
                             Console.Write("Hello");
                         else
                             Console.Write(" World!");
                       }
           }
}
填写IF语句里面的内容???
收集的答案如下,仅供大家参考学习,欢迎提出新方法
方法一:
if (new Func<bool>(() => { Console.Write("Hello"); returnfalse; }).Invoke())
方法二:
if ((args =newstring[1]{"Hello"}).Length >0&& args.Any(s=>{Console.Write(s);returnfalse;}))
方法三:
if (Console.Write("Hello") isobject)
方法四:
if (args.Length !=0?true : ((Func<bool>)delegate { Main(newstring[] { "a" }); returnfalse; }).Invoke())
 

相关文章:

  • 2022-12-23
  • 2021-10-27
  • 2022-12-23
  • 2021-11-08
  • 2018-11-08
  • 2021-10-08
  • 2021-07-09
猜你喜欢
  • 2021-06-10
  • 2021-08-15
  • 2021-06-07
  • 2019-01-04
  • 2022-01-17
  • 2021-05-16
相关资源
相似解决方案