]. When both
means that both arrays will refer to the same elements. If an error occurs
is undefined.
]. When both
means that both arrays will refer to the same elements. If an error occurs
is undefined.
two-dimensional array. Each element
three-dimensional array. Each
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