-
iostreams?
Is there an equivalent of << and/or >> operators for C#?
I just need something easy to use to convert everything to strings. It is really not nice using Convert.ToString(). I don't see the reason by the way why somethings cannot be overloaded, like make MessageBox.Show(int i), MessageBox.Show(string str), MessageBox.Show(DateTime dt) etc etc
-
All the integral types such as int are overloaded with toString() to display what you want.
so MessageBox.Show(i.toString());
-
ToString() is automatically called for each type when concatenating strings:
Code:
int i = 12;
float f = 3.4f;
double d = 5.6;
decimal dm = 7.8M;
System.DateTime dt = System.DateTime.Now;
System.Windows.Forms.MessageBox.Show("int: " + i + ", float: " + f +", double: " + d +", decimal: " + dm + ", datetime: " + dt);
-
lol, I knew there was a simple solution...