猜一猜,会输出什么?
刚才在项目中发现一个问题,跟踪了下也找不原因,做了下面这个Demo才突然明白...
你能得出输出结果吗?请自己验证一下输出结果.
还是蛮有意思的.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
string s = "zhz";
Console.WriteLine("AX:" + s == string.Empty ? "1111" : new A().FunA()+" World!");
Console.ReadLine();
}
}
class A
{
public string FunA()
{
return "Hello";
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
string s = "zhz";
Console.WriteLine("AX:" + s == string.Empty ? "1111" : new A().FunA()+" World!");
Console.ReadLine();
}
}
class A
{
public string FunA()
{
return "Hello";
}
}
}
少帮主的斧头好久不饮血了!