use where clause in a while loop : where « LINQ « C# / C Sharp
- C# / C Sharp
- LINQ
- where
use where clause in a while loop
using System;
using System.Collections.Generic;
using System.Linq;
public class MainClass {
public static void Main() {
IEnumerable<char> vowels = "aeiou";
IEnumerator<char> rator = vowels.GetEnumerator();
IEnumerable<char> query = "Not what you might expect";
char vowel;
while (rator.MoveNext()) {
vowel = rator.Current;
query = query.Where(c => c != vowel);
}
}
}
Related examples in the same category