สมมติว่าสตริงคือ −
Welcome User, Kindly wait for the image to load
สำหรับ Multiline String Literal ให้ตั้งค่าเหมือนคำสั่งต่อไปนี้โดยใช้@ นำหน้า −
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