public static SqlParameter AddWithValue(this SqlParameterCollection parameters, string paramName, object value, SqlDbTypeSize typeSize) { // Validation if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } if (paramName == null) { throw new ArgumentNullException(nameof(paramName)); } if (typeSize == null) { throw new ArgumentNullException(nameof(typeSize), nameof(typeSize) + String.Format("{0} is null for paramName {1}", nameof(typeSize), paramName)); } return(parameters.addWithValue(paramName, value, typeSize.SqlDbType, typeSize.Size)); }