Interesting, the base type of the Double is a System.ValueType, and it's base type is System.Object. Yes, I am surprised. Thanks for the puzzle.
U
User 4366736
@User 4366736
Posts
-
So how well do you think you know C#? -
So how well do you think you know C#?The Foo method is expecting a reference type (object), but it is getting a value type, probably double. Now the question is, does C# convert the value type to a reference type (boxing)? The reference type would be converted to a Nullable (double?), I don't think so. I don't think it will return a compile error. So I believe it will result in a runtime error (don't know what it would be). I'll run it after this post and see. Tony