I have some code like:
int value = 5;
MessageBox.Show ( value );
and the MessageBox.Show
complains saying:
"cannot convert from 'int' to 'string'"
I seem to remember some cases where values seem to be implicitly converted to string values, but can't recall them exactly.
What's the reason behind this decision that any value isn't implicitly convertible to string values?
MessageBox.Show()
only accepts a string. When you use something like Debug.WriteLine
, it accepts a bunch of different object types, including object
, and then calls ToString()
on that object. This is probably what you're experiencing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With