-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListExtensions.cs
More file actions
30 lines (28 loc) · 1.1 KB
/
ListExtensions.cs
File metadata and controls
30 lines (28 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// ############################################################################
// # Galen Lanphier #
// # https://github.com/lanphiergm/AdventOfCodeCS #
// # MIT License. See LICENSE file #
// ############################################################################
using System.Collections.Generic;
namespace AdventOfCode
{
/// <summary>
/// Contains extensions of the List class
/// </summary>
internal static class ListExtensions
{
/// <summary>
/// Swaps two elements in a list
/// </summary>
/// <typeparam name="T">The type of elements in the list</typeparam>
/// <param name="list">The list instance</param>
/// <param name="a">The index of the first item</param>
/// <param name="b">The index of the second item</param>
public static void Swap<T>(this List<T> list, int a, int b)
{
T tmp = list[a];
list[a] = list[b];
list[b] = tmp;
}
}
}