我不知道为什么我会System.IndexOutOfRangeException: 'Index was outside the bounds of the array.'使用这段代码
IEnumerable<char> query = "Text result";
string illegals = "abcet";
for (int i = 0; i < illegals.Length; i++)
{
query = query.Where(c => c != illegals[i]);
}
foreach (var item in query)
{
Console.Write(item);
}
Run Code Online (Sandbox Code Playgroud)
请有人解释我的代码有什么问题.