Difference between SkipWhile and Where in linq

added by jalpesh
4/17/2012 8:41:40 AM

3 Kicks, 279 Views

Before some time I have written a blog post about the SkipWhile operator and a reader of my blog asked me that we can do the same thing with Where also but there is a difference between this two. So In this post I am going to explain you difference between those two. Where operator filters a list of collection based on condition. It will filter whole collection while SkipWhile will only skip those elements in list until condition is true and after that it will stop filtering of skipping. Now let’s take an example where we can see the difference between Where and SkipWhile. Following is a code for that.


1 comments

dpeterson
4/17/2012 8:40:42 AM
I thought the same thing when I read your first post, thanks for clearing it up. :-)