tags:

views:

175

answers:

3

Hello all.

What's the different between Console.Write("H") and Console.Write('H') in C#. thanks.

:-)

+10  A: 

One uses a string overload (the string "H"), one uses a char overload (the char 'H'). Both output the character H to the stream defined in Console.Out without adding a newline.

sixlettervariables
+2  A: 

'H' is a single character (char) whereas "H" can have more than one character (string).

James
+2  A: 

The difference is that in the first call, you're passing a string and in the second call, you're passing a char. Practically speaking, those two calls are equivalent.

Adam Maras