Пример #1
0
 /// <summary>
 /// 获得一个新的<see cref="KeyValuePair{TKey, TNewValue}"/>
 /// </summary>
 /// <typeparam name="TKey">旧Key类型</typeparam>
 /// <typeparam name="TValue">旧Value类型</typeparam>
 /// <typeparam name="TNewValue">新Value类型</typeparam>
 /// <param name="oldKv"></param>
 /// <param name="value">新Value/param>
 /// <returns></returns>
 public static KeyValuePair <TKey, TNewValue> NewValue <TKey, TValue, TNewValue>(
     this KeyValuePair <TKey, TValue> oldKv,
     TNewValue value)
 {
     return(KeyValuePairExtensions.New(oldKv, t => t, t => value));
 }
Пример #2
0
 /// <summary>
 /// 获得一个新的<see cref="KeyValuePair{TNewKey, TValue}"/>
 /// </summary>
 /// <typeparam name="TKey">旧Key类型</typeparam>
 /// <typeparam name="TValue">旧Value类型</typeparam>
 /// <typeparam name="TNewKey">新Key类型</typeparam>
 /// <param name="oldKv"></param>
 /// <param name="key">新Key</param>
 /// <returns></returns>
 public static KeyValuePair <TNewKey, TValue> NewKey <TKey, TValue, TNewKey>(
     this KeyValuePair <TKey, TValue> oldKv,
     TNewKey key)
 {
     return(KeyValuePairExtensions.New(oldKv, t => key, t => t));
 }