public static string GetString(this NameValueCollection collection, string key, string defaultValue = null) { Condition.Requires(key, "key").IsNotNullOrWhiteSpace(); if (collection == null) { return defaultValue; } return collection.Get(key) ?? defaultValue; } }