3 ms·
C# linqs method - first or default has the same problem
by hardware2win 4y ago
C# linqs method - first or default has the same problem
- int_19h 4y agoThe method itself just uses the default value of the corresponding type. If you have a sequence of ints, and you cast it to Nullable<int> first before applying FirstOrDefault, then you can distinguish between null and 0.