OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
Loading...
Searching...
No Matches
Pollyfill.cs
1using System;
2using System.Collections.Generic;
3
4namespace OSDP.Net.Utilities;
5
9public static class Pollyfill
10{
21 public static bool TryAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue value)
22 {
23 if (dictionary == null)
24 {
25 throw new ArgumentNullException(nameof(dictionary));
26 }
27
28 if (!dictionary.ContainsKey(key))
29 {
30 dictionary.Add(key, value);
31 return true;
32 }
33
34 return false;
35 }
36}
Provide backward compability to .NET standard 2.0.
Definition Pollyfill.cs:10
static bool TryAdd< TKey, TValue >(this IDictionary< TKey, TValue > dictionary, TKey key, TValue value)
Attempts to add the specified key and value to the dictionary.
Definition Pollyfill.cs:21