+ 1

Can anyone explain this bit of code? I don't really get the expression assigned to x.

I think the method assigns 14 if it finds it in the array otherwise returns 0. But I ain't sure if I'm correct. static void Main(string[] args) { int[] arr = {10,15,16 }; var x = arr.FirstOrDefault(z => z.Equals(14)); Console.WriteLine(x + 15); }

10th Jan 2020, 4:09 PM
Giura Emanuel
Giura Emanuel - avatar
2 Answers
10th Jan 2020, 4:11 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
0
Thanks! I usually stop at Microsoft docs but sometimes it's quite confusing to understand what they explain.
10th Jan 2020, 4:18 PM
Giura Emanuel
Giura Emanuel - avatar