Clearest way to declare a char value containing a single quote/apostrophe

前端 未结 6 1321
庸人自扰
庸人自扰 2021-01-07 16:22

To declare a char value in C# we just surround the character with single quotes: \'x\'.

But what is the \"clearest\" way to declare a char value that

6条回答
  •  旧时难觅i
    2021-01-07 17:10

    I guess it's a matter of personal preference, I find escaping it clearest, eg:

    char c = '\'';
    

提交回复
热议问题