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";
3,在識別符號中的使用string strsql = @"select * from humanresources.employee as e
inner join person.contact as c
on e.contactid = c.contactid
order by c.lastname";
c#是不允許關鍵字作為識別符號(類名、變數名、方法名、表空間名等)使用的,但如果加上@
之後就可以了
例如:
public static void @static(int @int)
else if (@int == 0)
else
C 中 的作用
雙冒號 操作符被稱為域操作符 scope operator 含義和用法如下 1.在類外部宣告成員函式。void point area 2.呼叫全域性函式 表示引用成員函式變數及作用域,作用域成員運算子 例 system math sqrt 相當於system.math.sqrt 3.呼叫類的靜態方法...
c 中 的作用
1.用 可以不用寫轉義字元。如檔案路徑,可以不用寫兩個反斜槓,即忽略轉義 2.可以讓字串跨行。1 string script 2a 1 3b hello world 4c true56 d 1415 function e 16print i am e 17end 1819 function f a,...
C 中 的作用
雙冒號 操作符被稱為域操作符 scope operator 含義和用法如下 1.在類外部宣告成員函式。void point area 2.呼叫全域性函式 表示引用成員函式變數及作用域,作用域成員運算子 例 system math sqrt 相當於system.math.sqrt 3.呼叫類的靜態方法...