I have a FormCollection and I just want to only iterate through the keys the do not contain the string pricing.
So what I tried was this...
foreach (
Are you sure that you're using Where
and not Select
?
Using Where
will return an IEnumerable<string>
which is what you're expecting.
Using Select
will return an IEnumerable<bool>
which is what you say is actually happening.
Here is the answer...
foreach (var key in collection.AllKeys.Where(k => !k.Contains("Pricing")).ToArray<string>()){ ... }