ทำการเปิดไฟล์ Program.cs ขึ้นมา
ตัวอย่างคำสั่งแสดง "Hello World!" ใน console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Console.WriteLine("Hello World!"); |
ตอนนี้คุณสามารถประกาศตัวแปรหนึ่งบรรทัดด้านบนโค้ดข้างบนในไฟล์ ด้วยโค้ด
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var name = "Steve"; // use your name here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ชื่อตัวแปร = ค่าของตัวแปร; |
ตอนนี้ให้ทำการลบ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Console.WriteLine("Hello World!"); |
ออก แล้วแทนที่ด้วย
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var name = "Steve"; // use your name here | |
Console.WriteLine($"Hello {name}!"); |
แล้วรันด้วยคำสั่ง
dotnet runผลลัพธ์
Hello Steve
0 ความคิดเห็น:
แสดงความคิดเห็น