-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new general extension methods and utilities
- Loading branch information
1 parent
0ebe67f
commit 3df605a
Showing
3 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace KKAPI.MainGame | ||
{ | ||
/// <summary> | ||
/// An equality comparer that uses StringComparison.OrdinalIgnoreCase rule | ||
/// </summary> | ||
public class IgnoreCaseEqualityComparer : IEqualityComparer<string> | ||
{ | ||
/// <inheritdoc /> | ||
public bool Equals(string x, string y) | ||
{ | ||
if (x == null || y == null) return false; | ||
return x.Equals(y, StringComparison.OrdinalIgnoreCase); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public int GetHashCode(string obj) | ||
{ | ||
return obj.GetHashCode(); | ||
} | ||
|
||
/// <summary> | ||
/// Instance of the comparer for use in linq and such | ||
/// </summary> | ||
public static readonly IgnoreCaseEqualityComparer Instance = new IgnoreCaseEqualityComparer(); | ||
} | ||
} |