From 53e877183abe0dbbb623c39380101bc369e9f265 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 2 Dec 2017 00:44:45 -0800 Subject: Support tuples from extensions and make SourcePath a path instead of string --- src/WixToolset.Data/DictionaryExtensions.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/WixToolset.Data/DictionaryExtensions.cs (limited to 'src/WixToolset.Data/DictionaryExtensions.cs') 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 @@ +// 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. + +namespace WixToolset.Data +{ + using System.Collections.Generic; + + internal static class DictionaryExtensions + { + public static V GetValueOrDefault(this IDictionary dictionary, K key, V defaultValue = default(V)) + { + return dictionary.TryGetValue(key, out var value) ? value : defaultValue; + } + } +} -- cgit v1.2.3-55-g6feb