You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

KeyValuePairExtensions.cs 864 B

123456789101112131415161718192021222324
  1. using System.Collections.Generic;
  2. namespace LLama.Extensions
  3. {
  4. /// <summary>
  5. /// Extensions to the KeyValuePair struct
  6. /// </summary>
  7. public static class KeyValuePairExtensions
  8. {
  9. /// <summary>
  10. /// Deconstruct a KeyValuePair into it's constituent parts.
  11. /// </summary>
  12. /// <param name="pair">The KeyValuePair to deconstruct</param>
  13. /// <param name="first">First element, the Key</param>
  14. /// <param name="second">Second element, the Value</param>
  15. /// <typeparam name="TKey">Type of the Key</typeparam>
  16. /// <typeparam name="TValue">Type of the Value</typeparam>
  17. public static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> pair, out TKey first, out TValue second)
  18. {
  19. first = pair.Key;
  20. second = pair.Value;
  21. }
  22. }
  23. }