Contains Internally Uses IndexOf
public bool Contains(string value, StringComparison comparisonType) { #pragma warning disable CA2249 // Consider using 'string.Contains' instead of 'string.IndexOf' ... this is the implementation of Contains! return IndexOf(value, comparisonType) >= 0; #pragma warning restore CA2249 }
A C# code snippet shows that the implementation of `Contains` calls `IndexOf`, while suppressing the warning that recommends using `Contains` instead of `IndexOf`. The joke is the circular and self-referential implementation: the method being recommended is already built on the supposedly discouraged method. EN: A C# code snippet shows that the implementation of `Contains` calls `IndexOf`, while suppressing the warning that recommends using `Contains` instead of `IndexOf`. The joke is the circular and self-referential implementation: the method being recommended is already built on the supposedly discouraged method.
- @ithueti / 9340 2023-04-27
- Type
- image
- Size
- 800×78 · 13.7 KiB
- Mood
- ironic
- Language
- en
- Added