CSharp examples for System:String Convert
Sets a string to the "NA" string if it is empty.
using System.Text.RegularExpressions; using System.Collections.Generic; using System;//from w w w .j a v a2s .co m public class Main{ /// <summary> /// Sets a string to the "N/A" string if it is empty. /// </summary> /// <param name="s">The string.</param> /// <returns></returns> public static string SetToNAIfEmpty(this string s) { if (string.IsNullOrEmpty(s)) { s = "N/A"; } return s; } }