Link to home
Start Free TrialLog in
Avatar of mawingpui
mawingpuiFlag for Hong Kong

asked on

Enumerable Skip

I have two codes as follow,

Code 1
           int[] grades = { 1, 2, 3, 4, 5 };

            var q = from c in grades.Skip(1)
                    select c;

            foreach (int number in q)
                Console.WriteLine("{0}", number);

Open in new window


Code 2
            int[] grades = { 1, 2, 3, 4, 5 };

            var q = from c in grades
                    where c > 1
                    select c;

            foreach (int number in q)
                Console.WriteLine("{0}", number);

Open in new window


They provide the same result.
If the list contains billion values and filter condition is different, base on the performance which one is better?
SOLUTION
Avatar of kris_per
kris_per

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial