C# 0 The Complete Reference



Download 4,07 Mb.
Pdf ko'rish
bet799/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   795   796   797   798   799   800   801   802   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

dest

,

                                 int 



destStar t,

                                 int 



count

)

Copies



count

 elements from 



source

[

srcStar t

] to 

dest

[

destStar t

]. When both 

arrays are reference types, then 

Copy( )

 makes a “shallow copy,” which 

means that both arrays will refer to the same elements. If an error occurs 

during the copy



dest

 is undefined.

public static void Copy(Array 

source

,

                                 long 



srcStar t

,

                                 Array 



dest

,

                                 long 



destStar t,

                                 long 



count

)

Copies



count

 elements from 



source

[

srcStar t

] to 

dest

[

destStar t

]. When both 

arrays are reference types, then 

Copy( )

 makes a “shallow copy,” which 

means that both arrays will refer to the same elements. If an error occurs 

during the copy, 



dest

 is undefined.

public void CopyTo(Array 

dest

, int 


star t

)

Copies the elements of the invoking array to 



dest,

 beginning at 



dest

[

start

].

public void CopyTo(Array 



dest

,

                                     long 



star t

)

Copies the elements of the invoking array to 



dest,

 beginning at 



dest

[

start

].

public static Array



    CreateInstance(Type 

t

, int 


size

)

Returns a reference to a one-dimensional array that contains 



size

 elements 

of type 

t.

public static Array

   CreateInstance(Type 

t

, int 


size1

, int 


size2

)

Returns a reference to a 



size1

-by-


size2

 two-dimensional array. Each element 

is of type 

t.

public static Array

    CreateInstance(Type 

t

, int 


size1

,

                           int 



size2

, int 


size3

)

Returns a reference to a 



size1

-by-


size2

-by-


size3

 three-dimensional array. Each 

element is of type 

t.

public static Array

    CreateInstance(Type 

t

, int[ ] 



sizes

)

Returns a reference to a multi-dimensional array that has the dimensions 



specified in 

sizes.

 Each element is of type 



t.

public static Array

    CreateInstance(Type 

t

, long[ ] 



sizes

)

Returns a reference to a multi-dimensional array that has the dimensions 



specified in 

sizes.

 Each element is of type 



t.

public static Array

    CreateInstance(Type 

t

, int[ ] 



sizes

,

                           int[ ] 



star tIndexes

)

Returns a reference to a multi-dimensional array that has the dimensions 



specified in 

sizes.

 Each element is of type 



t.

 The star ting index of each 

dimension is specified in 

star tIndexes.

 Thus, it is possible to create arrays 

that begin at some index other than zero.

T

ABLE



 21-12 

Methods Defi ned by 

Array

(continued)

Method


Meaning

www.freepdf-books.com




644

 

P a r t   I I :  



E x p l o r i n g   t h e   C #   L i b r a r y

public override bool Equals(object 



v

)

Returns true if the value of the invoking object equals the value of 



v.

public static bool Exists(T[ ] a,

                                   Predicate 

pred

)

Returns true if 



a

 contains at least one element that satisfies the predicate 

specified by 

pred.

 Returns false if no elements satisfy 



pred.

public static T Find(T[ ] 



a

,

                                  Predicate 



pred

)

Returns the first element in 



a

 that satisfies the predicate specified by 



pred

. If 


no element satisfies 

pred,

 then 


default(T)

 is returned. 

public static T[ ] FindAll(T[ ] 

a

,

                                  Predicate 



pred

)

Returns an array that contains all elements in 



a

 that satisfy the predicate 

specified by 

pred.

 If no element satisfies 



pred, 

then a zero-length array is 

returned. 

public static int FindIndex(T[ ] 



a

,

                                  Predicate 



pred

)

Returns the index of the first element in 



a

 that satisfies the predicate 

specified by 

pred.

 If no element satisfies 



pred,

 –1 is returned. 

public static int FindIndex(T[ ] 

a

,

                                  int 



star t

,

                                  Predicate 



pred

)

Returns the index of the first element in 



a

 that satisfies the predicate 

specified by 

pred.

 The search begins at 



a

[

star t

]. If no element satisfies 

pred,

–1 is returned. 

public static int FindIndex(T[ ] 

a

,

                                   int 



star t

,

                                   int 



count

,

                                   Predicate 



pred

)

Returns the index of the first element in 



a

 that satisfies the predicate 

specified by 

pred.

 The search begins at 



a

[

star t

] and runs for 

count

 elements. 

If no element satisfies 

pred,

 –1 is returned. 

public static T FindLast(T[ ] 

a

,

                                  Predicate 



pred

)

Returns the last element in 



a

 that satisfies the predicate specified by 



pred.

 If 


no element satisfies 

pred,

 then 


default(T)

 is returned. 

public static int FindLastIndex(T[ ] 

a

,

                                   Predicate 



pred

)

Returns the index of the last element in 



a

 that satisfies the predicate 

specified by 

pred

. If no element satisfies 



pred,

 –1 is returned. 

public static int FindLastIndex(T[ ] 

a

,

                                   int 



star t

,

                                   Predicate 



pred

)

Returns the index of the last element in 



a

 that satisfies the predicate 

specified by 

pred.

 The search proceeds in reverse order, beginning at 



a

[

start

]

and stopping at 



a

[0]. If no element satisfies 



pred,

 –1 is returned. 

public static int FindLastIndex(T[ ] 

a

,

                                   int 



star t

,

                                   int 



count

,

                                   Predicate 



pred

)

Returns the index of the last element in 



a

 that satisfies the predicate 

specified by 

pred.

 The search proceeds in reverse order, beginning at 



a

[

star t

]

and running for 



count

 elements. If no element satisfies 



pred

, –1 is returned. 

public static void ForEach(T[ ] a,

                                  Action 



act

)

Applies the method specified by 



act

 to each element of 



a.

public IEnumerator GetEnumerator( )

Returns an enumerator object for the array. An enumerator enables you to 

cycle through an array. Enumerators are described in Chapter 24.

public override int GetHashCode( )

Returns the hash code for the invoking object.

public int GetLength(int 

dim

)

Returns the length of the specified dimension. The dimension is zero-based. 



Thus, to get the length of the first dimension, pass 0; to obtain the length of 

the second dimension, pass 1; and so on.

public long GetLongLength(int 

dim

)

Returns the length of the specified dimension as a 



long

. The dimension is 

zero-based. Thus, to get the length of the first dimension, pass 0; to obtain 

the length of the second dimension, pass 1; and so on.

public int GetLowerBound(int 

dim

)

Returns the first index of the specified dimension, which is usually zero. 



The parameter 

dim

 is zero-based. Thus, to get the star t index of the first 

dimension, pass 0; to obtain the star t index of the second dimension, pass 

1; and so on.

public int GetUpperBound(int 

dim

)

Returns the last index of the specified dimension. The parameter 



dim

 is zero-

based. Thus, to get the last index of the first dimension, pass 0; to obtain 

the last index of the second dimension, pass 1; and so on.

T

ABLE


 21-12 

Methods Defi ned by 

Array

(continued)

Method


Meaning

www.freepdf-books.com




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   795   796   797   798   799   800   801   802   ...   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