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



Download 21,46 Mb.
Pdf ko'rish
bet198/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   194   195   196   197   198   199   200   201   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

The Data Type Class Hierarchy

It is very interesting to note that even the primitive .NET data types are arranged in a “class hierar-

chy.” If you are new to the world of inheritance, you will discover the full details in Chapter 6. Until

then, just understand that types at the top of a class hierarchy provide some default behaviors that

are granted to the derived types. The relationship between these core system types can be under-

stood as shown in Figure 3-6.



Figure 3-6.

The class hierarchy of system types

C H A P T E R   3  



C O R E   C #   P R O G R A M M I N G   C O N S T R U C T S, PA RT   I



83

8849CH03.qxd  9/24/07  11:07 AM  Page 83




Notice that each of these types ultimately derives from System.Object, which defines a set of

methods (ToString(), Equals(), GetHashCode(), and so forth) common to all types in the .NET base

class libraries (these methods are fully detailed in Chapter 6).

Also note that many numerical data types derive from a class named System.ValueType.

Descendents of ValueType are automatically allocated on the stack and therefore have a very pre-

dictable lifetime and are quite efficient. On the other hand, types that do not have System.ValueType

in their inheritance chain (such as System.Type, System.String, System.Array, System.Exception,

and System.Delegate) are not allocated on the stack, but on the garbage-collected heap.

Without getting too hung up on the details of System.Object and System.ValueType for the time

being (again, more details in Chapter 4), just understand that because a C# keyword (such as int) is

simply shorthand notation for the corresponding system type (in this case, System.Int32), the fol-

lowing is perfectly legal syntax, given that System.Int32 (the C# int) eventually derives from

System.Object, and therefore can invoke any of its public members, as illustrated by this additional

helper function:

static void ObjectFunctionality()

{

Console.WriteLine("=> System.Object Functionality:");




Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   194   195   196   197   198   199   200   201   ...   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