{
if (array == null)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
- int lb = array.GetLowerBound(0);
- return BinarySearch(array, lb, array.Length, value, null);
+ return BinarySearch(array, array.GetLowerBound(0), array.Length, value, null);
}
// Searches a section of an array for a given element using a binary search
int endIndex = startIndex + count;
for (int i = startIndex; i < endIndex; i++)
{
- if (match(array[i])) return i;
+ if (match(array[i]))
+ return i;
}
return -1;
}
}
}
- // GetEnumerator returns an IEnumerator over this Array.
- //
- // Currently, only one dimensional arrays are supported.
- //
- public IEnumerator GetEnumerator()
- {
- int lowerBound = GetLowerBound(0);
- if (Rank == 1 && lowerBound == 0)
- return new SZArrayEnumerator(this);
- else
- return new ArrayEnumerator(this, lowerBound, Length);
- }
-
// Returns the index of the first occurrence of a given value in an array.
// The array is searched forwards, and the elements of the array are
// compared to the given value using the Object.Equals method.
{
for (int i = startIndex; i < endIndex; i++)
{
- if (objArray[i] == null) return i;
+ if (objArray[i] == null)
+ return i;
}
}
else
for (int i = startIndex; i < endIndex; i++)
{
object obj = objArray[i];
- if (obj != null && obj.Equals(value)) return i;
+ if (obj != null && obj.Equals(value))
+ return i;
}
}
}
object obj = array.GetValue(i);
if (obj == null)
{
- if (value == null) return i;
+ if (value == null)
+ return i;
}
else
{
- if (obj.Equals(value)) return i;
+ if (obj.Equals(value))
+ return i;
}
}
}
{
for (int i = startIndex; i >= endIndex; i--)
{
- if (objArray[i] == null) return i;
+ if (objArray[i] == null)
+ return i;
}
}
else
for (int i = startIndex; i >= endIndex; i--)
{
object obj = objArray[i];
- if (obj != null && obj.Equals(value)) return i;
+ if (obj != null && obj.Equals(value))
+ return i;
}
}
}
object obj = array.GetValue(i);
if (obj == null)
{
- if (value == null) return i;
+ if (value == null)
+ return i;
}
else
{
- if (obj.Equals(value)) return i;
+ if (obj.Equals(value))
+ return i;
}
}
}
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
Reverse(array, 0, array.Length);
}
-
+
public static void Reverse<T>(T[] array, int index, int length)
{
if (array == null)
return true;
}
-
+#if !CORERT
// Private value type used by the Sort methods.
private readonly struct SorterObjectArray
{
}
}
+ public IEnumerator GetEnumerator()
+ {
+ int lowerBound = GetLowerBound(0);
+ if (Rank == 1 && lowerBound == 0)
+ return new SZArrayEnumerator(this);
+ else
+ return new ArrayEnumerator(this, lowerBound, Length);
+ }
+
private sealed class SZArrayEnumerator : IEnumerator, ICloneable
{
private readonly Array _array;
{
get
{
- if (_index < 0) ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumNotStarted();
- if (_index >= _endIndex) ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumEnded();
+ if (_index < 0)
+ ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumNotStarted();
+ if (_index >= _endIndex)
+ ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumEnded();
return _array.GetValue(_index);
}
}
_indices[_indices.Length - 1]--;
}
}
+#endif // !CORERT
}
-}
\ No newline at end of file
+}