C#中@符号的作用
一、忽略轉(zhuǎn)義字符
string fileName = "D:\\文本文件\\text.txt"; string fileName = @"D:\文本文件\text.txt";二、讓字符串跨行
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 eINNER JOIN Person.Contact AS cON e.ContactID = c.ContactIDORDER BY c.LastName";三 、C#是不允許關(guān)鍵字作為標(biāo)識(shí)符(類名、變量名、方法名、表空間名等)使用的,但如果加上@之后就可以了。
public?static?void?@static(int?@int){if?(@int?> 0){System.Console.WriteLine("Positive Integer");}else?if?(@int?== 0){System.Console.WriteLine("Zero");}else{System.Console.WriteLine("Negative Integer");}?????????? }?
?
?
?
?
總結(jié)
- 上一篇: 自动图片轮播php源码,js实现自动图片
- 下一篇: Java中的向下转型与向上转型