SwapHelper.cs 606 B

12345678910111213141516171819202122232425
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Topten.RichTextKit
  5. {
  6. /// <summary>
  7. /// Helper class to swap two values
  8. /// </summary>
  9. public static class SwapHelper
  10. {
  11. /// <summary>
  12. /// Swaps two values
  13. /// </summary>
  14. /// <typeparam name="T">The value type</typeparam>
  15. /// <param name="a">The first value</param>
  16. /// <param name="b">The second value</param>
  17. public static void Swap<T>(ref T a, ref T b)
  18. {
  19. var temp = a;
  20. a = b;
  21. b = temp;
  22. }
  23. }
  24. }