How does the .Max(...) work in LINQ? What will be the result of the following code?

var result = new[] { "hello", "world", "factory", "x" }.Max(p => p.Length);

Experience Level: Junior
Tags: .NETC#LINQ

Answer

Explanation

The transform function p => p.Length will be executed on evey element of the array and the Length of the element will be identified. The biggest length will then be returned.

The value of the variable result will be 7.

Comments

No Comments Yet.
Be the first to tell us what you think.

Chat

Oh, the operator is not available. Leave us your comments. We will answer all your questions as soon as possible.

Comments

Anonymous
Καλησπέρα.
Anonymous
the infinteis -3/15 so 1triition / infinet
Anonymous
e
Anonymous
<a href="https://inspirum.pl "
Anonymous
[url]https://inspirum.pl[/url]
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e