Sakura.AspNetCore.Extensions/Sakura.AspNetCore.Mvc.PagedList/Internal/Utility.cs
/// <summary>
///     Try get the value associated with the speicified key in a dictionary. If the key is not presented, return a custom
///     default value.
/// </summary>
/// <typeparam name="TKey">The key type of the <paramref name="dictionary" />.</typeparam>
/// <typeparam name="TValue">The value type of the <paramref name="dictionary" />.</typeparam>
/// <param name="dictionary">The dictionary which contains all key and values.</param>
/// <param name="key">The key associated with the target value in the <paramref name="dictionary" />.</param>
/// <param name="defaultValue">
///     The default value if <paramref name="key" /> is not presented in the
///     <paramref name="dictionary" />.
/// </param>
/// <returns>
///     If the <paramref name="key" /> is presented in the <paramref name="dictionary" />, returns its associated
///     value; otherwise, returns the <paramref name="defaultValue" />.
/// </returns>
Try get the value associated with the speicified key in a dictionary. If the key is not presented, return a custom
default value.
Try get the value associated with the speicified key in a dictionary . If the key is not presented return a custom default value .
public static TValue GetValueOfDefault<TKey, TValue>([NotNull] this IDictionary<TKey, TValue> dictionary, TKey key,
			TValue defaultValue = default(TValue))
		{
			if (dictionary == null)
				throw new ArgumentNullException(nameof(dictionary));
			return dictionary.TryGetValue(key, out var result) ? result : defaultValue;
		}
public static TValue GetValueOfDefault < TKey , TValue > ( [ NotNull ] this IDictionary < TKey , TValue > dictionary , TKey key , TValue defaultValue = default ( TValue ) ) { if ( dictionary == null ) throw new ArgumentNullException ( nameof ( dictionary ) ) ; return dictionary . TryGetValue ( key , out var result ) ? result : defaultValue ; }
Try get the value associated with the speicified key in a dictionary.
Try get the value associated with the speicified key in a dictionary .
If the  is presented in the , returns its associated
value; otherwise, returns the .
If the is presented in the returns its associated value ; otherwise returns the .
this
[NotNull]
key
TKey
The key associated with the target value in the .
The key associated with the target value in the .
defaultValue
TValue
The default value if  is not presented in the
.
The default value if is not presented in the .
dictionary
The dictionary which contains all key and values.
The dictionary which contains all key and values .
typeparam
The key type of the .
The key type of the .
typeparam
The value type of the .
The value type of the .