Last active
December 14, 2015 08:48
-
-
Save k0stya/5059924 to your computer and use it in GitHub Desktop.
Reshaper highlights n.Value saying that there is a possibility of InvalidOperationException.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
namespace Nullable | |
{ | |
public class Nullable_Test | |
{ | |
public void SumNullableNumbers() | |
{ | |
int?[] numbers = new int?[10]; | |
int sum = numbers.Where(n => n.HasValue).Sum(n => n.Value); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment