collection.Add(新用户{Name =“Dede”,Description =“渣打大厦
6788 Ayala Avenue,Makati City
886-7143
M - F - 早上6:30 - 凌晨1:00
S - 太阳 - 关闭“});
在构建结束时出现错误,如何添加后续字符串以使其没有错误?我不想失去空间的格式和所有原因。
答案 0 :(得分:5)
试试这个:
collection.Add(new User {
Name = "Dede",
Description =
@"Standard Chartered Building
6788 Ayala Avenue, Makati City
886-7143
M - F - 6:30am - 1:00am
S - Sun - closed"
});
注意@
。
答案 1 :(得分:3)
使用逐字字符串文字:
string s = @"this
is all one
string";
leading @告诉编译器使用逐字文字。唯一的转义字符是“必须加倍”“。执行:
string s = "single: "" ; double """" ";