using System.Collections.Generic; namespace NModbus.Extensions { internal static class DictionaryExtensions { /// /// Gets the specified value in the dictionary. If not found, returns default for TValue. /// /// /// /// /// /// internal static TValue? GetValueOrDefault(this IDictionary dictionary, TKey key) { TValue value; if (dictionary.TryGetValue(key, out value!)) return value; return default(TValue); } } }