使用者工具

網站工具


visual_c_sharp

差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

Both sides previous revision 前次修改
visual_c_sharp [2024/06/25 15:00]
don [string]
visual_c_sharp [2024/06/25 15:03] (目前版本)
don [string]
行 3: 行 3:
  
 ==== string ==== ==== string ====
-[code]+<code>
 string a = "hello, world";                // hello, world string a = "hello, world";                // hello, world
 string b = @"hello, world";               // hello, world string b = @"hello, world";               // hello, world
行 16: 行 16:
 two two
 three"; three";
-[/code]+</code>
  
 上面是msdn給的例子,說明了加不加@的差別, 上面是msdn給的例子,說明了加不加@的差別,
行 33: 行 33:
 2.讓字串連接跨行 2.讓字串連接跨行
 不使用@符號,一種寫法是這樣的: 不使用@符號,一種寫法是這樣的:
-[code]+<code>
 string strSQL= "SELECT * FROM HumanResources.Employee AS e" + string strSQL= "SELECT * FROM HumanResources.Employee AS e" +
            " INNER JOIN Person.Contact AS c" + " ON e.ContactID = c.ContactID" +            " INNER JOIN Person.Contact AS c" + " ON e.ContactID = c.ContactID" +
            " ORDER BY c.LastName";            " ORDER BY c.LastName";
-[/code]+</code>
 加上@符號後就可以直接換行了: 加上@符號後就可以直接換行了:
-[code]+<code>
 string strSQL= @"SELECT * FROM HumanResources.Employee AS e string strSQL= @"SELECT * FROM HumanResources.Employee AS e
         INNER JOIN Person.Contact AS c         INNER JOIN Person.Contact AS c
         ON e.ContactID = c.ContactID         ON e.ContactID = c.ContactID
         ORDER BY c.LastName";         ORDER BY c.LastName";
- [/code]+</code>
 3.在識別字中的用法 3.在識別字中的用法
 C#是不允許關鍵字作為識別字(類名、變數名、方法名、表空間名等)使用的,但如果加上@之後就可以了。 C#是不允許關鍵字作為識別字(類名、變數名、方法名、表空間名等)使用的,但如果加上@之後就可以了。
-[code]+<code>
 例如 string @string="abcdef"; 例如 string @string="abcdef";
      int @int = 123456789;      int @int = 123456789;
-[/code]+</code>
 來自 <https://blog.xuite.net/david670919/twblog/499762471>  來自 <https://blog.xuite.net/david670919/twblog/499762471> 
  
  
visual_c_sharp.txt · 上一次變更: 2024/06/25 15:03 由 don