Advertisement
wasdswag

swap

May 11th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.33 KB | None | 0 0
  1. // swap two elements of list:
  2. // based on answer here https://stackoverflow.com/questions/552731/c-good-best-implementation-of-swap-method
  3.  
  4.     List<Boid> Swap(List<Boid> list, int indexA, int indexB)
  5.     {
  6.         Boid tmp = list[indexA];
  7.         list[indexA] = list[indexB];
  8.         list[indexB] = tmp;
  9.         return list;
  10.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement