c 中 的用法

2021-05-22 00:21:33 字數 714 閱讀 1249

c#中的@至少有以下幾種作用

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 中 的用法

從這個帖子開始記錄一下我學習和工作當中遇到的問題,以及解決方法等等。最經公司需要對於乙個c 做的瀏覽器外掛程式做維護,使得以前沒接觸過c 的我遇到了一大堆問題,在這記錄下c 中 的用法 是運算子中等級最高的,它分為三種 1 global scope 全域性作用域符 用法 name 2 class s...

C 中 的用法

一 字串中的用法 1。地球人都知道 c 中 字串常量可以以 開頭聲名,這樣的優點是轉義序列 不 被處理,按 原樣 輸出,即我們不需要對轉義字元加上 反斜扛 就可以輕鬆coding。如,c code?1 stringfilepath c docs source a.txt rather than c ...

C 中 的用法

一 字串中的用法 1。地球人都知道 c 中 字串常量可以以 開頭聲名,這樣的優點是轉義序列 不 被處理,按 原樣 輸出,即我們不需要對轉義字元加上 反斜扛 就可以輕鬆coding。如,c code?1 stringfilepath c docs source a.txt rather than c ...