一道很有意思的面试题目(转)

面试题如下:完成如下代码,使其输出“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())
 
原文地址:https://www.cnblogs.com/Yukang1989/p/2290684.html