它是一种简单的问题,但我有疑问,请参阅初级讲座为什么不抛出异常
public static String something;
static void Main(string[] args)
{
try
{
if (something == "blah")
System.Console.Write("ok");
}
catch (Exception)
{
throw;
}
}
的代码,我知道这并不抛出异常,但为什么呢?因为变量的名称是空的,当你比较的时候你试图用null来获取引用。有人可以向我解释为什么?谢谢!