Unintuitive behaviour with struct initialization and default arguments
public struct Test { public double Val; public Test(double val = double.NaN) { Val = val; } public bool IsValid { get { return !double.IsNaN(Val); } } } Test myTest = new Test(); bool valid = myTest.IsValid; The above gives valid==true because the constructor with default arg is NOT called and the object is created with the standard default val = 0.0. If the struct is a class the behaviour is valid==false which is what I would expect. I find this difference in behaviour and particularly the behaviour in the struct case suprising and unintuitive - what is going on? What does the default arg on