- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
public static IEnumerable<T> Remove<T>(this IEnumerable<T> source, T key)
{
return source.Where(element => !element.Equals(key));
}
public static IEnumerable<string> Remove(this IEnumerable<string> source, string key)
{
return source.Where(element => element != key);
}
shit.RemoveAll(x => !x.Equals(anotherShit))
и
shit.RemoveAll(x => x != anotherShit))
для строк
вместо
shit.Remove(anotherShit)
> За счёт интернирования
string a = "AAA";
string b = new String('A', 3);
и где теперь твой бог string.intern?