前言 本文来聊一聊我们经常会做的空值检查问题,从一个简单的空值检查Any Where,到设计模式的NullObjectPattern,再到C#6.0“可能”会提供的语法,让我们体验一次语言开发上的“持续改进”,Let’s go~ 什么是空引用异常 作为一个敲过代码的码农来说,似乎没有谁没有遇到过NullReferenceException这个问题,有些时候当方法内部调用一个属性.方法(委托)时,我们控制这些属性在“外部”的表现(当然某些情况下使用ref关键字除外),所以我们要在方法的内部去判断属…