Practice mode C#

Which C# pattern matches a value that is an int greater than 100, as in x is > 100?

Correct answer B. A relational pattern

Explanation

Relational patterns, added in C# 9, compare a value against a constant using <, or >=. They can be combined with the logical patterns and, or and not, as in x is >= 1 and <= 9. A discard pattern _ matches anything, a var pattern captures any value, and a list pattern matches sequences such as [1, 2, ..].

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.