易丰科技

标题: C# Conditional Operator (?:) and Null-Coalescing Operator ?? [打印本页]

作者: Calvin    时间: 2011-10-16 14:16
标题: C# Conditional Operator (?:) and Null-Coalescing Operator ??

  1. string fileName = tempFileName != null ?
  2.                                  tempFileName : "Untitled";
复制代码

  1. string fileName = tempFileName ?? "Untitled";
复制代码

  1. int? count = null;

  2. int amount = count ?? default(int);
复制代码







欢迎光临 易丰科技 (http://forum.yftek.com/) Powered by Discuz! X3