Created
March 6, 2019 21:27
-
-
Save InvaderZim85/0e7852c72f9dfa4c8df20b939fc18a17 to your computer and use it in GitHub Desktop.
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
// Contains | |
public static bool ContainsIgnoreCase(this string value, string substring) | |
{ | |
if (string.IsNullOrEmpty(substring)) | |
return false; | |
return value.IndexOf(substring, StringComparison.OrdinalIgnoreCase) >= 0; | |
} | |
// Equals | |
public static bool EqualsIgnoreCase(this string value, string match) | |
{ | |
if (string.IsNullOrEmpty(match)) | |
return false; | |
return string.Equals(value, match, StringComparison.OrdinalIgnoreCase); | |
} | |
// Anwendung | |
var myList = new List<string>(); | |
var result = myList.Where(w => w.ContainsIgnoreCase(searchstring)).ToList(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment