chr
2024-08-07 22beee93f14d042aa184148c53efb79e23416526
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System.Collections.Generic;
 
namespace PdmSwPlugin.Common.Util
{
    public static class DictionaryUtil
    {
        public static T Get<T>(this Dictionary<string, T> dict, string key, T defaultValue = default)
        {
            if (key == null)
            {
                return defaultValue;
            }
            if (dict == null || !dict.ContainsKey(key))
            {
                return defaultValue;
            }
            return dict[key];
        }
    }
}