Why does this string extension method not throw an exception?
问题 I've got a C# string extension method that should return an IEnumerable<int> of all the indexes of a substring within a string. It works perfectly for its intended purpose and the expected results are returned (as proven by one of my tests, although not the one below), but another unit test has discovered a problem with it: it can't handle null arguments. Here's the extension method I'm testing: public static IEnumerable<int> AllIndexesOf(this string str, string searchText) { if (searchText =