1.忽略轉義字元
例如string filename = "d:\文字檔案\text.txt";
使用@後
string filename = @"d:文字檔案\text.txt";
2.讓字串跨行
例如string strsql = "select * from humanresources.employee as e"
" inner join person.contact as c"
" on e.contactid = c.contactid"
" order by c.lastname";
使用@後
string strsql = @"select * from humanresources.employee as e
inner join person.contact as c
on e.contactid = c.contactid
order by c.lastname";
3.在識別符號中的用法
c#是不允許關鍵字作為識別符號(類名、變數名、方法名、表空間名等)使用的,但如果加上@之後就可以了
例如public static void @static(int @int)
else if (@int == 0)
else
}
c 程式設計之 的3種作用
對 的作用不是很清晰,學習了一下,站在巨人的肩膀上總結如下 例如string filename d 文字檔案 text.txt 使用 後 string filename d 文字檔案 text.txt 例如 string strsql select from humanresources.emplo...
c 中 的3種作用
1.忽略轉義字元例如1 stringfilename d 文字檔案 text.txt 使用 後 1 stringfilename d 文字檔案 text.txt 2.讓字串跨行例如1 2 3 4 stringstrsql select from humanresources.employee as ...
c 中 的3種作用
以前只知道 在c 中為了寫檔案路徑的 不要加轉義符而在前面加上 識別符號,沒想到 還有其他的作用 1.忽略轉義字元 例如string filename d 文字檔案 text.txt 使用 後 string filename d 文字檔案 text.txt 2.讓字串跨行 stringstrsql ...