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 903 B

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