-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtendToolkit.cs
More file actions
30 lines (26 loc) · 835 Bytes
/
ExtendToolkit.cs
File metadata and controls
30 lines (26 loc) · 835 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
using MinecraftLaunch.Modules.Models.Auth;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace System {
public static class ExtendToolkit {
public static string ToUri(this string raw) {
if (raw.EndsWith('/')) {
return Regex.Replace(raw, ".$", "");
} else {
return raw;
}
}
public static async ValueTask<List<T>> ToListAsync<T>(this IAsyncEnumerable<T> raw) {
List<T> list = new();
await foreach (var i in raw) {
list.Add(i);
}
return list;
}
public static List<T> ToList<T>(this IAsyncEnumerable<T> raw) => ToListAsync(raw).Result;
}
}