以下引用官方描述: ? The FreeMarker template language doesn't know the Java language null at all. It doesn't have null keyword, and it can't test if something is null or not. 1.判断是否存在,通过exists关键字或者"??"运算符.都将返回一个布尔值 user.name?exists user.name?? ? <#if…
类型的转换在日常的变成中是经常被用到的,我们最常用的类型转换的方法就是Convert和Parse, 下面来说一下这两者null值处理的区别. int i1 = Convert.ToInt32(null);//i1=0 int i2 = Int32.Parse(null);//throw an expection:Value cannot be null. 由此可见,Convert对null值是有容错的,如果是null则返回0,而Parse没有做容错,会抛出异常. 多说一句. object obj…