Practice mode C#

Which LINQ query-syntax expression selects numbers greater than 5 from an array nums?

Correct answer A. from n in nums where n > 5 select n

Explanation

C# query expressions start with a from clause naming a range variable and source, then optional clauses such as where and orderby, and must end with select or group. Unlike SQL, select comes last, which lets IntelliSense know the range variable's type. The compiler translates the query into method calls: nums.Where(n => n > 5).

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.