C# 0 The Complete Reference



Download 4,07 Mb.
Pdf ko'rish
bet86/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   82   83   84   85   86   87   88   89   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

myvar

 and 


MyVar

 are separate names. Here are some examples of acceptable identifiers:

Test

x

y2



MaxLoad

up

_top



my_var

sample23


Remember, you can’t start an identifier with a digit. Thus, 

12x

 is invalid, for example. Good 

programming practice dictates that you choose identifiers that reflect the meaning or usage 

of the items being named.

Although you cannot use any of the reserved C# keywords as identifiers, C# does allow 

you to precede a keyword with an @, allowing it to be a legal identifier. For example, 



@for

is a valid identifier. In this case, the identifier is actually 



for

 and the @ is ignored. Here is a 

program that illustrates the use of an 

@

 identifier:

// Demonstrate an @ identifier.

using System;

class IdTest {

  static void Main() {

    int @if; // use if as an identifier

    for(@if = 0; @if < 10; @if++)

      Console.WriteLine("@if is " + @if);

  }


}

The output shown here proves the 



@if

 is properly interpreted as an identifier:

@if is 0

@if is 1


@if is 2

@if is 3


@if is 4

from


get

group


into

join


let

orderby


par tial

select


set

value


where

yield


T

ABLE


 2-2 

The C# Contextual Keywords

www.freepdf-books.com



34

 

P a r t   I :  



T h e   C #   L a n g u a g e

@if is 5


@if is 6

@if is 7


@if is 8

@if is 9


Frankly, using @-qualified keywords for identifiers is not recommended, except for 

special purposes. Also, the @ can precede any identifier, but this is considered bad practice.




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   82   83   84   85   86   87   88   89   ...   1096




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish