/// <summary> /// Checks value of given column of given row for emptiness, /// considering value as string. Works with default data row /// version. /// </summary> /// <param name="row">DataRow with values to check.</param> /// <param name="column">Column name.</param> /// <returns> /// Returns true, if value of given column of given row is not empty string, /// and false otherwise. /// </returns> public static bool IsNotEmptyString(DataRow row, string column) { if (row == null) { throw new ArgumentNullException("row"); } if (String.IsNullOrEmpty(column)) { throw new ArgumentException(Resources.Error_EmptyString, "column"); } return(DataInterpreter.IsNotEmptyString(row, column, DataRowVersion.Default)); }
/// <summary> /// Writes value of given column of given data row to given string builder with /// given prefix if this value is not empty string. /// </summary> /// <param name="row">Data row to extract value.</param> /// <param name="column">Column name to look for value.</param> /// <param name="prefix">Prefix to write.</param> /// <param name="target">String builder to write.</param> /// <param name="quote">Indicates if value should be quoted.</param> public static void WriteIfNotEmptyString(DataRow row, string column, string prefix, StringBuilder target, bool quote) { if (row == null) { throw new ArgumentNullException("row"); } if (String.IsNullOrEmpty(column)) { throw new ArgumentException(Resources.Error_EmptyString, "column"); } if (target == null) { throw new ArgumentNullException("target"); } if (DataInterpreter.IsNotEmptyString(row, column)) { if (!String.IsNullOrEmpty(prefix)) { target.Append(prefix); } WriteValue(row, column, target, quote); } }