Image Resizer : API Documentation

Type NameValueCollectionExtensions

Namespace ImageResizer.ExtensionMethods

Public static methods

T Get<T>(NameValueCollection q, string name, T defaultValue)

Provides culture-invariant parsing of int, double, float, bool, and enum values.

Nullable<T> Get<T>(NameValueCollection q, string name, Nullable<T> defaultValue)

Provides culture-invariant parsing of int, double, float, bool, and enum values.

Nullable<T> Get<T>(NameValueCollection t, string name)

Provides culture-invariant parsing of int, double, float, bool, and enum values.

T[] GetList<T>(NameValueCollection q, string name, Nullable<T> fallbackValue, Int32[] allowedSizes)

bool IsOneSpecified(NameValueCollection q, String[] keys)

Returns true if any of the specified keys contain a value

NameValueCollection Keep(NameValueCollection q, String[] keysToKeep)

Creates and returns a new NameValueCollection instance that contains only the specified keys from the current collection.

NameValueCollection Normalize(NameValueCollection q, string primary, string secondary)

Normalizes a command that has two possible names. If either of the commands has a null or empty value, those keys are removed. If both the the primary and secondary are present, the secondary is removed. Otherwise, the secondary is renamed to the primary name.

T[] ParseList<T>(string text, Nullable<T> fallbackValue, Int32[] allowedSizes)

Parses a comma-delimited list of primitive values. If there are unparsable items in the list, they will be replaced with 'fallbackValue'. If fallbackValue is null, the function will return null

Nullable<T> ParsePrimitive<T>(string value, Nullable<T> defaultValue)

Provides culture-invariant parsing of int, double, float, bool, and enum values.

string SerializePrimitive<T>(Nullable<T> val)

NameValueCollection Set<T>(NameValueCollection q, string name, Nullable<T> val)

Provides culture-invariant serialization of value types, in lower case for querystring readability. Setting a key to null removes it.

NameValueCollection SetAsString<T>(NameValueCollection q, string name, T val)

Serializes the given value by calling.ToString(). If the value is null, the key is removed.

NameValueCollection SetList<T>(NameValueCollection q, string name, T[] values, bool throwExceptions, Int32[] allowedSizes)