CollectionExtensions.cs 426 B

1234567891011121314
  1. using System.Collections.Generic;
  2. namespace MediaBrowser.Common.Extensions
  3. {
  4. // The MS CollectionExtensions are only available in netcoreapp
  5. public static class CollectionExtensions
  6. {
  7. public static TValue GetValueOrDefault<TKey, TValue> (this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key)
  8. {
  9. dictionary.TryGetValue(key, out var ret);
  10. return ret;
  11. }
  12. }
  13. }