Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a variable of type char to have a value of ' in c#

Tags:

c#

A bit of a dumb one... but how do I get a variable of type char to have a value of '?

e. g.

char c = ''';
char a = 'A';
char b = 'B';
like image 797
Mark Pearl Avatar asked Dec 09 '22 17:12

Mark Pearl


1 Answers

char c = '\'';

the backslash is called an escape character.

and if you want a backslash it's

char c = '\\';

Here's some more for good measure:

  • \t - tab
  • \n - new line
  • \uXXXX - where XXXX is the hexadecimal value of a unicode character
like image 187
blank Avatar answered Feb 23 '23 18:02

blank