17 lines
458 B
C#
17 lines
458 B
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
|
|||
|
namespace NzbDrone.Common
|
|||
|
{
|
|||
|
public static class DictionaryExtensions
|
|||
|
{
|
|||
|
public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue = default(TValue))
|
|||
|
{
|
|||
|
TValue value;
|
|||
|
return dictionary.TryGetValue(key, out value) ? value : defaultValue;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|