[英]How to connect three-line code in C#?
我正在使用Visual Studio 2010 C#創建應用程序。
我的代碼中有一個內聯字符串,導致該代碼無法編譯。 該字符串包含換行符,因此跨多行,而不是單行。
我應該怎么做才能使字符串與換行符保持一致,同時使我的代碼得以編譯?
您可以簡單地連接字符串。 所以
string s = "I am a very long string that will probably not adhere to your coding " +
"guidelines. So I am split across several concateneted strings.";
s += "Since this might look silly the += operator is used, too.";
會將所有行都放入字符串s中。
這能回答您的問題嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.