C#中字符串常量表达为:
string str = “abcd”;
其中若字符串里需要显示双引号时,可以有两种方法:
一、转义符号
string str = “abc " hello world " def”;
二、使用@在字符串前面,但用两个双引号表示“ “ ” ”
string str = @“abc " " hello world " " def”;
@的作用为可以取消转义符“\”的作用,也可以让字符串输入换行输入。
C#中字符串常量表达为:
string str = “abcd”;
其中若字符串里需要显示双引号时,可以有两种方法:
一、转义符号
string str = “abc " hello world " def”;
二、使用@在字符串前面,但用两个双引号表示“ “ ” ”
string str = @“abc " " hello world " " def”;
@的作用为可以取消转义符“\”的作用,也可以让字符串输入换行输入。