aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Extensions/CollectionExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Common/Extensions/CollectionExtensions.cs')
-rw-r--r--MediaBrowser.Common/Extensions/CollectionExtensions.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/MediaBrowser.Common/Extensions/CollectionExtensions.cs b/MediaBrowser.Common/Extensions/CollectionExtensions.cs
new file mode 100644
index 000000000..f7c0e3cf0
--- /dev/null
+++ b/MediaBrowser.Common/Extensions/CollectionExtensions.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+
+namespace MediaBrowser.Common.Extensions
+{
+ // The MS CollectionExtensions are only available in netcoreapp
+ public static class CollectionExtensions
+ {
+ public static TValue GetValueOrDefault<TKey, TValue> (this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key)
+ {
+ dictionary.TryGetValue(key, out var ret);
+ return ret;
+ }
+ }
+}