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


// Instance level, nonvirtual members



Download 21,46 Mb.
Pdf ko'rish
bet435/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   431   432   433   434   435   436   437   438   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

// Instance level, nonvirtual members.

public Type GetType();

protected object MemberwiseClone();

// Static members.

public static bool Equals(object objA, object objB);

public static bool ReferenceEquals(object objA, object objB);

}

Table 6-1 offers a rundown of the functionality provided by each method.



Table 6-1.

Core Members of System.Object

Instance Method of Object Class

Meaning in Life

Equals()


By default, this method returns true only if the items being

compared refer to the exact same item in memory. Thus,

Equals() is used to compare object references, not the state of

the object. Typically, this method is overridden to return true

only if the objects being compared have the same internal state

values (that is, value-based semantics). Be aware that if you

override Equals(), you should also override GetHashCode(), as

these methods are used internally by Hashtable types to retrieve

subobjects from the container.

GetHashCode()

This method returns an int that identifies a specific object

instance.

GetType()

This method returns a Type object that fully describes the object

you are currently referencing. In short, this is a Runtime Type

Identification (RTTI) method available to all objects (discussed

in greater detail in Chapter 16).

ToString()

This method returns a string representation of this object, using

the . format (termed the fully qualified



name). This method can be overridden by a subclass to return a

tokenized string of name/value pairs that represent the object’s

internal state, rather than its fully qualified name.

Finalize()

For the time being, you can understand this method (when

overridden) is called to free any allocated resources before the

object is destroyed. I talk more about the CLR garbage collection

services in Chapter 8.

MemberwiseClone()

This method exists to return a member-by-member copy of the

current object, which is often used when cloning an object (see

Chapter 9).

To illustrate some of the default behavior provided by the Object base class, create a new C#

Console Application named ObjectOverrides. Insert a new C# class type that contains the following

empty class definition for a type named Person:


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   431   432   433   434   435   436   437   438   ...   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