简体   繁体   中英

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

C#中Console.Write(“H”)和Console.Write('H')之间的区别是什么?

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.

'H'是单个字符( char ),而“H”可以有多个字符( string )。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM