コード例 #1
0
        public static Dictionary <string, TExpected> ToDictionary <TSource, TExpected>(this IDictionaryParameter source,
                                                                                       Func <TSource, TExpected> valueSelector)
        {
            if (valueSelector == null)
            {
                throw new ArgumentNullException(nameof(valueSelector));
            }

            if (!(source is DictionaryParameter <TSource> dictionaryParameter))
            {
                throw new ArgumentException($"{nameof(source)}不是指定类型[{typeof(TSource)}]的参数");
            }

            var allValue = dictionaryParameter.GetAllValue();

            return(allValue.ToDictionary(keyValuePair => keyValuePair.Key,
                                         keyValuePair => valueSelector(keyValuePair.Value)));
        }
コード例 #2
0
        public void Replace(IDictionaryParameter dictionaryParameter)
        {
            var parameter = (DictionaryParameter <T>)dictionaryParameter;

            _values = parameter._values;
        }