private static string GetStringValue(ParameterAttribute attribute, object value) { if (value is DateTime) { value = ((DateTime)value).ToUniversalTime(); } else if (value is Boolean) { value = ((Boolean)value).GetHashCode(); } return(string.Format(CultureInfo.InvariantCulture, attribute.FormatString ?? "{0}", value)); }
private static string GetStringValue(ParameterAttribute attribute, object value) { if (value is DateTime) { value = ((DateTime)value).ToUniversalTime(); } else if (value is Boolean) { value = ((Boolean)value).GetHashCode(); } return string.Format (CultureInfo.InvariantCulture, attribute.FormatString ?? "{0}", value); }
private static KeyValuePair <string, ValueHolder> ParameterFromValue(string suffix, ParameterAttribute attribute, object value, bool excludeFromHash) { return(new KeyValuePair <string, ValueHolder>( attribute.Name + suffix, new ValueHolder { Value = GetStringValue(attribute, value), ExcludeFromHash = excludeFromHash || attribute.ExcludeFromHash, SortIndex = attribute.SortIndex } )); }
private static KeyValuePair<string, ValueHolder> ParameterFromValue(string suffix, ParameterAttribute attribute, object value, bool excludeFromHash) { return new KeyValuePair<string, ValueHolder>( attribute.Name + suffix, new ValueHolder { Value = GetStringValue(attribute, value), ExcludeFromHash = excludeFromHash || attribute.ExcludeFromHash, SortIndex = attribute.SortIndex } ); }