aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Data/DictionaryExtensions.cs
blob: cb6647ff2d8dc22e138ae3cbec40ab3d70900a69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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<K, V>(this IDictionary<K, V> dictionary, K key, V defaultValue = default(V))
        {
            return dictionary.TryGetValue(key, out var value) ? value : defaultValue;
        }
    }
}