forked from BornToBeRoot/NETworkManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListHelper.cs
More file actions
34 lines (25 loc) · 758 Bytes
/
Copy pathListHelper.cs
File metadata and controls
34 lines (25 loc) · 758 Bytes
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
31
32
33
34
using System.Collections.Generic;
namespace NETworkManager.Utilities;
public static class ListHelper
{
public static List<string> Modify(List<string> list, string entry, int length)
{
var index = list.IndexOf(entry);
if (index != -1)
list.RemoveAt(index);
else if (list.Count == length)
list.RemoveAt(length - 1);
list.Insert(0, entry);
return list;
}
public static List<int> Modify(List<int> list, int entry, int length)
{
var index = list.IndexOf(entry);
if (index != -1)
list.RemoveAt(index);
else if (list.Count == length)
list.RemoveAt(length - 1);
list.Insert(0, entry);
return list;
}
}