lixiaojun
2025-03-12 c9d8259d39dd1c55b112aa9d10f64b80bb91995f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
namespace Yw.Epanet
{
    /// <summary>
    /// 字典拓展
    /// </summary>
    internal static class DictionaryExtensions
    {
        /// <summary>
        /// 获取值
        /// </summary>
        public static TValve GetValue<TValve>(this Dictionary<string, TValve> dict, string key)
        {
            if (dict == null || dict.Count < 1)
            {
                return default;
            }
            if (string.IsNullOrEmpty(key))
            {
                return default;
            }
            if (dict.ContainsKey(key))
            {
                return dict[key];
            }
            return default;
        }
 
 
    }
}