public static string DbValStr(this PrdnJobStatus status) { if (status == PrdnJobStatus.New) { return null; } else { return status.ConvertToString().ToUpper(); } }
public static Expression ConvertTo(this Expression E, Type T) { if (E.GetType() == typeof(ConstantExpression)) return ((ConstantExpression)E).ConvertTo(T); if (E.GetType() == typeof(VarAutExpression)) return ((VarAutExpression)E).Getter(T); if (E.Type == T) return E; else if (T == typeof(string)) return E.ConvertToString(); else if (NumericType.Contains(T)) return E.ConvertToNumber(T); else if (T == typeof(bool)) return E.ConvertToBool(); else if (T == typeof(object)) return Expression.Convert(E, T); else return Expression.Convert(Expression.Call(Convert_ChangeType, Expression.Convert(E, typeof(object)), Expression.Constant(T, typeof(Type))), T); }
/// <summary> /// Convert the matrix to a string /// </summary> /// <param name="matrix"> /// The matrix. /// </param> /// <param name="format"> /// The format. /// </param> /// <param name="columnWidth"> /// The column Width. /// </param> /// <returns> /// The to string. /// </returns> public static string ToString(this Matrix3D matrix, string format, int columnWidth) { if (format == null) { throw new ArgumentNullException("format"); } return matrix.ConvertToString(format, "\t", "\n", columnWidth, CultureInfo.InvariantCulture); }
/// <summary> /// Convert the matrix to a string using invariant culture and '\t' and '\n' as separators. /// </summary> /// <param name="matrix"> /// The matrix. /// </param> /// <param name="columnWidth"> /// The column Width. /// </param> /// <returns> /// The to string. /// </returns> public static string ToString(this Matrix3D matrix, int columnWidth) { return matrix.ConvertToString("N" + columnWidth, 20); }
/// <summary> /// Converts to string using the specified format and the invariant culture /// </summary> /// <param name="matrix"> /// The matrix. /// </param> /// <param name="format"> /// Format string, e.g. "N8" /// </param> /// <param name="columnWidth"> /// Width of column, number of characters /// </param> /// <returns> /// A string. /// </returns> internal static string ConvertToString(this Matrix3D matrix, string format, int columnWidth) { CultureInfo provider = CultureInfo.InvariantCulture; return matrix.ConvertToString(format, "\t", "\n", columnWidth, provider); }
/// <summary> /// Convert the matrix to a string /// </summary> /// <param name="matrix"> /// The matrix. /// </param> /// <param name="format"> /// The format. /// </param> /// <param name="columnSeparator"> /// The column Separator. /// </param> /// <param name="lineSeparator"> /// The line Separator. /// </param> /// <param name="columnWidth"> /// The column Width. /// </param> /// <param name="provider"> /// The provider. /// </param> /// <returns> /// A string. /// </returns> public static string ToString( this Matrix3D matrix, string format, string columnSeparator, string lineSeparator, int columnWidth, CultureInfo provider) { return matrix.ConvertToString(format, columnSeparator, lineSeparator, columnWidth, provider); }