Nullable types arithmetic and null-coalescing operator precedence

added by DotNetKicks
3/30/2018 1:30:05 PM

2 Kicks, 312 Views

Here is a simple question for you: which version of a GetHashCode() is correct and what the performance impact incorrect version would have? public struct Struct1{ public int N { get; } public string S { get; } public Struct1(int n, string s = null) { N = n; S = s; } public override int GetHashCode() => N ^ S?.GetHashCode()...