ข้ามไปที่เนื้อหาหลัก

คำสงวนในการตั้งชื่อตัวแปร (Keywords in C#)


         คำสงวนหรือคำต้องห้าม คือ คำที่ไม่สามารถนำมาใช้ในการประกาศค่าตัวแปรใน ภาษา C# ได้ โดยคำเหล่านั้นส่วนใหญ่เป็นคำที่นำไปทำหน้าทีอย่างอื่นอยู่แล้ว จึงไม่อนุญาติให้ใช้ซ้ำกันได้ ดังนี้


abstract
as
base
bool
break
byte
catch
case
char
checked
class
const
continue
decimal
default
delegate
do
double
else
enum
explicit
event
extern
false
finally
fixed
float
for
foreach
goto
if
implicit
in
int
interface
internal
is
lock
long
namespace
new
null
object
operator
out
override
params
private
protected
public
readonly
ref
return
sbyte
sealed
short
sizeof
stackalloc
static
struct
string
switch
this
throw
true
try
typeof
uint
ulong
unchecked
unsafe
ushort
using
virtual
volatile
void
while

ซึ่งทั้งนี้เป้นคำห้ามใช้ตั้งชื่อตัวแปรใน ภาษา C# นะครับ ซึ่งต่อไปในอนาคตอาจมีการเปลี่ยนแปลง เพิ่มเติม ก็เป็นไปได้ขึ้นอยู่กับผู้พํฒนา

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

วิธีสำรองข้อมูลระบบปฏิบัติการ Linux โดยใช้คำสั่ง “dd”

1. เราสามารถสร้างไฟล์ Backup ของฮาร์ดดิสก์และบันทึกลงในอุปกรณ์จัดเก็บข้อมูลอื่นๆ มีข้อดีหลายประการในการสำรองข้อมูลของคุณไปเป็นอิมเมจ อีกประการหนึ่งคือความสะดวกในการใช้งาน โดยทั่วไปวิธีนี้จะเร็วกว่าการสำรองข้อมูลประเภทอื่น ทำให้คุณสามารถกู้คืนข้อมูลได้อย่างรวดเร็วหลังเกิดเหตุที่ไม่คาดคิดขึ้น ใช้คำสั่งด้านล่างเพื่อสำรองข้อมูลฮาร์ดดิสก์ /dev/sda ไปเป็นไฟล์อิมเมจของดิสก์  # dd if=/dev/sda of=/var/tmp/sda_disk.img   if: ไดรฟ์ต้นทาง (/dev/sda)  of: ไดรฟ์ปลายทาง (/dev/sdb)   2.ในการกู้คืนฮาร์ดดิสก์ด้วยไฟล์อิมเมจที่เราสร้างขึ้น ให้ใช้คำสั่ง dd ต่อไปนี้   # dd if=sda_disk.img of=/dev/sdc   if: ไดรฟ์ต้นทาง (/dev/sda)  of: ไดรฟ์ปลายทาง (/dev/sdb)

การแปลงวันที่และเวลาโดยใช้ SQL Server

รูปแบบวันที่ของ SQL Server มีหลายรูปแบบใช้ตัวเลือกรูปแบบวันที่พร้อมกับฟังก์ชั่น เช่น - ต้องการรูปแบบ YYYY-MM-DD ใช้คำสั่งคือ  SELECT CONVERT(varchar, getdate(), 23) -  ต้องการรูปแบบ  MM/DD/YYYY  ใช้คำสั่งคือ   SELECT CONVERT(varchar, getdate(), 1)   ด้านล่างนี้เป็นรายการรูปแบบและตัวอย่างของผลลัพธ์   DATE ONLY FORMATS Format # Query Sample 1 select convert(varchar, getdate(), 1) 12/30/06 2 select convert(varchar, getdate(), 2) 06.12.30 3 select convert(varchar, getdate(), 3) 30/12/06 4 select convert(varchar, getdate(), 4) 30.12.06 5 select convert(varchar, getdate(), 5) 30-12-06 6 select convert(varchar, getdate(), 6) 30 Dec 06 7 select convert(varchar, getdate(), 7) Dec 30, 06 10 select convert(varchar, getdate(), 10) 12-30-06 11 select convert(varchar, getdate(), 11) 06/12/30 12 select convert(varchar, getdate(), 12) 061230 23 select convert(varchar, getdate(), 23) 2006-12-30 101 select convert(varchar, getda...

วิธีการติดตั้ง Docker บน Debian 9 (Stretch)

Step 1  ก่อนติดตั้ง ถ้ามีการติดตั้ง  Docker มาก่อน ต้องลบก่อนนะครับด้วยคำสั่ง  apt-get purge docker lxc-docker docker-engine docker.io ตอนนี้ติดตั้งแพ็คเกจที่จำเป็นบนระบบของคุณเพื่อติดตั้ง Docker บนระบบ Debian ใช้คำสั่งด้านล่างนี้นี้ครับ: apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common Step 2 ติดตั้ง Docker Repository สร้างคีย์ เพื่อเอาไว้ตรวจสอบลายเซ็นของ packages ก่อนติดตั้งครับด้วยคำสั่งต่อไปนี้ apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common หลังจากนั้นให้เพิ่มที่เก็บ Docker บนระบบ Debian ของคุณซึ่งมีแพ็คเกจ Docker รวมถึงการอ้างอิง คุณต้องเปิดใช้งานที่เก็บนี้เพื่อติดตั้ง Docker บน Debian ด้วยคำสั่งดังนี้ add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian stretch stable" Step   3 — ติดตั้ง Docker on Debian 9 ระบบของคุณพร้อมสำหรับการติดตั้ง Docker แล้ว รันคำสั่งต่อไปนี้ เลย apt-get update  apt-get install docker-ce  หลังจากติดตั้ง Do...