mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 10:18:27 -04:00
Using new .Chunk and .DistinctBy Linq Extensions
This commit is contained in:
@@ -39,7 +39,7 @@ public partial class Utility
|
||||
{
|
||||
var selection = typeof(Math).GetTypeInfo()
|
||||
.GetMethods()
|
||||
.Distinct(new MethodInfoEqualityComparer())
|
||||
.DistinctBy(x => x.Name)
|
||||
.Select(x => x.Name)
|
||||
.Except(new[]
|
||||
{
|
||||
@@ -51,11 +51,4 @@ public partial class Utility
|
||||
await SendConfirmAsync(GetText(strs.calcops(Prefix)), string.Join(", ", selection));
|
||||
}
|
||||
}
|
||||
|
||||
private class MethodInfoEqualityComparer : IEqualityComparer<MethodInfo>
|
||||
{
|
||||
public bool Equals(MethodInfo x, MethodInfo y) => x.Name == y.Name;
|
||||
|
||||
public int GetHashCode(MethodInfo obj) => obj.Name.GetHashCode(StringComparison.InvariantCulture);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user