diff options
Diffstat (limited to 'src/WixToolset.Data/DictionaryExtensions.cs')
| -rw-r--r-- | src/WixToolset.Data/DictionaryExtensions.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/WixToolset.Data/DictionaryExtensions.cs b/src/WixToolset.Data/DictionaryExtensions.cs new file mode 100644 index 00000000..cb6647ff --- /dev/null +++ b/src/WixToolset.Data/DictionaryExtensions.cs | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Data | ||
| 4 | { | ||
| 5 | using System.Collections.Generic; | ||
| 6 | |||
| 7 | internal static class DictionaryExtensions | ||
| 8 | { | ||
| 9 | public static V GetValueOrDefault<K, V>(this IDictionary<K, V> dictionary, K key, V defaultValue = default(V)) | ||
| 10 | { | ||
| 11 | return dictionary.TryGetValue(key, out var value) ? value : defaultValue; | ||
| 12 | } | ||
| 13 | } | ||
| 14 | } | ||
