在指定 String 数组的每个元素之间串联指定的分隔符 String,从而产生单个串联的字符串。
例如,如果 separator 为“,”且 value 的元素为“apple”、“orange”、“grape”和“pear”,
则 Join(separator, value) 返回“apple, orange, grape, pear”。
如果 separator 为 nullNothingnullptrnull 引用(在 Visual Basic 中为 Nothing),则改用空字符串 (Empty)。
2.?? 运算符
如果 ?? 运算符的左操作数非 null,该运算符将返回左操作数,否则返回右操作数。
// ?? operator example. int? x = null;
// y = x, unless x is null, in which case y = -1. int y = x ?? -1;
3. String.IsNullOrEmpty 方法返回值类型: System.Boolean
如果 value 参数为 nullNothingnullptrnull 引用(在 Visual Basic 中为 Nothing) 或空字符串 (""),
则为 true;否则为 false
4.String.Format 方法
将指定的 String 中的格式项替换为指定的 Object 实例的值的文本等效项
s = String.Format( "(d) Short date: . . . . . . . {0:d}/n",DateTime.Now);
输出:
(d) Short date: . . . . . . . 6/26/2004