This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy



Download 21,46 Mb.
Pdf ko'rish
bet250/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   246   247   248   249   250   251   252   253   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition



Note

The C# 


ref

keyword will be revisited later in this chapter in the section “Understanding Value Types and

Reference Types.” As you will see, the behavior of this keyword changes just a bit depending on whether the argu-

ment is a “value type” (structure) or “reference type” (class).



The params Modifier

Last but not least, C# supports the use of parameter arrays. To understand the role of the params

keyword, you must (as the name implies) understand how to manipulate C# arrays. If this is not the

case, you may wish to return to this section once you have finished this chapter, as we will formally

examine the System.Array type a bit later in this chapter in the section “Array Manipulation in C#.”

The params keyword allows you to pass into a method a variable number of parameters (of the

same type) as a 

single logical parameter. As well, arguments marked with the params keyword can be

processed if the caller sends in a strongly typed array or a comma-delimited list of items. Yes, this

can be confusing! To clear things up, assume you wish to create a function that allows the caller to

pass in any number of arguments and return the calculated average.

If you were to prototype this method to take an array of doubles, this would force the caller to

first define the array, then fill the array, and finally pass it into the method. However, if you define

CalculateAverage() to take a params of integer data types, the caller can simply pass a comma-

delimited list of doubles. The .NET runtime will automatically package the set of doubles into an

array of type double behind the scenes:


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   246   247   248   249   250   251   252   253   ...   1830




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