在 C# 中如何定義多行字串文字?
假設字串是 −
Welcome User, Kindly wait for the image to load
對於多行字串文字,首先使用 @ 字首將其像以下語句一樣進行設定 −
string str = @"Welcome User, Kindly wait for the image to load";
現在讓我們顯示結果。該字串現在是一個多行字串 −
示例
using System;
namespace Demo {
class Program {
static void Main(string[] args) {
string str = @"Welcome User,
Kindly wait for the image to
load";
Console.WriteLine(str);
}
}
}輸出
Welcome User, Kindly wait for the image to load
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP