C# 0 The Complete Reference


PART I C h a p t e r   8



Download 4,07 Mb.
Pdf ko'rish
bet288/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   284   285   286   287   288   289   290   291   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt


PART I

C h a p t e r   8 :  

A   C l o s e r   L o o k   a t   M e t h o d s   a n d   C l a s s e s  

211


PART IPART I

Static Classes

Beginning with C# 2.0, you can declare a class 



static

. There are two key features of a 



static

class. First, no object of a 



static

 class can be created. Second, a 



static

 class must contain only 



static

 members. A 



static

 class is created by modifying a class declaration with the keyword 



static

, shown here.

static class 

class

-

name

 { // ...

Within the cla ss, all members must be explicitly specified as 



static

. Making a class 



static

does not automatically make its members 



static

.

static

 classes have two primary uses. First, a 

static

 class is required when creating 

an

extension method,

 which is a new feature added by C# 3.0. Extension methods relate 

mostly to LINQ, and a discussion of extensions methods is found in Chapter 19. Second, 

a

static

 class is used to contain a collection of related 

static

 methods. This second use is 

demonstrated here.

The following example uses a 




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   284   285   286   287   288   289   290   291   ...   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