You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@ -312,12 +312,17 @@ namespace System
|
||||
public object GetValue (int index)
|
||||
{
|
||||
if (Rank != 1)
|
||||
throw new ArgumentException (Locale.GetText ("Array was not a one-dimensional array."));
|
||||
if (index < GetLowerBound (0) || index > GetUpperBound (0))
|
||||
throw new ArgumentException (SR.Arg_RankMultiDimNotSupported);
|
||||
|
||||
var lb = GetLowerBound (0);
|
||||
if (index < lb || index > GetUpperBound (0))
|
||||
throw new IndexOutOfRangeException (Locale.GetText (
|
||||
"Index has to be between upper and lower bound of the array."));
|
||||
|
||||
return GetValueImpl (index - GetLowerBound (0));
|
||||
if (GetType ().GetElementType ().IsPointer)
|
||||
throw new NotSupportedException ("Type is not supported");
|
||||
|
||||
return GetValueImpl (index - lb);
|
||||
}
|
||||
|
||||
public object GetValue (int index1, int index2)
|
||||
@ -335,12 +340,17 @@ namespace System
|
||||
public void SetValue (object value, int index)
|
||||
{
|
||||
if (Rank != 1)
|
||||
throw new ArgumentException (Locale.GetText ("Array was not a one-dimensional array."));
|
||||
if (index < GetLowerBound (0) || index > GetUpperBound (0))
|
||||
throw new ArgumentException (SR.Arg_RankMultiDimNotSupported);
|
||||
|
||||
var lb = GetLowerBound (0);
|
||||
if (index < lb || index > GetUpperBound (0))
|
||||
throw new IndexOutOfRangeException (Locale.GetText (
|
||||
"Index has to be >= lower bound and <= upper bound of the array."));
|
||||
|
||||
SetValueImpl (value, index - GetLowerBound (0));
|
||||
if (GetType ().GetElementType ().IsPointer)
|
||||
throw new NotSupportedException ("Type is not supported");
|
||||
|
||||
SetValueImpl (value, index - lb);
|
||||
}
|
||||
|
||||
public void SetValue (object value, int index1, int index2)
|
||||
@ -589,31 +599,6 @@ namespace System
|
||||
return source.IsAssignableFrom (target) || target.IsAssignableFrom (source);
|
||||
}
|
||||
|
||||
public static T[] FindAll<T> (T[] array, Predicate<T> match)
|
||||
{
|
||||
if (array == null)
|
||||
throw new ArgumentNullException ("array");
|
||||
|
||||
if (match == null)
|
||||
throw new ArgumentNullException ("match");
|
||||
|
||||
int pos = 0;
|
||||
T[] d = Empty<T>();
|
||||
for (int i = 0; i < array.Length; i++) {
|
||||
if (match (array [i])) {
|
||||
if (pos == d.Length)
|
||||
Resize (ref d, pos == 0 ? 4 : pos * 2);
|
||||
|
||||
d [pos++] = array [i];
|
||||
}
|
||||
}
|
||||
|
||||
if (pos != d.Length)
|
||||
Resize (ref d, pos);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
|
||||
//
|
||||
// The constrained copy should guarantee that if there is an exception thrown
|
||||
@ -624,9 +609,40 @@ namespace System
|
||||
Copy (sourceArray, sourceIndex, destinationArray, destinationIndex, length);
|
||||
}
|
||||
|
||||
object GetValueWithFlattenedIndex_NoErrorCheck (int flattenedIndex)
|
||||
public static T[] Empty<T>()
|
||||
{
|
||||
return GetValueImpl (flattenedIndex);
|
||||
return EmptyArray<T>.Value;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static int IndexOfImpl<T>(T[] array, T value, int startIndex, int count)
|
||||
{
|
||||
return EqualityComparer<T>.Default.IndexOf (array, value, startIndex, count);
|
||||
}
|
||||
|
||||
static int LastIndexOfImpl<T>(T[] array, T value, int startIndex, int count)
|
||||
{
|
||||
return EqualityComparer<T>.Default.LastIndexOf (array, value, startIndex, count);
|
||||
}
|
||||
|
||||
static void SortImpl (Array keys, Array items, int index, int length, IComparer comparer)
|
||||
{
|
||||
Object[] objKeys = keys as Object[];
|
||||
Object[] objItems = null;
|
||||
if (objKeys != null)
|
||||
objItems = items as Object[];
|
||||
|
||||
if (objKeys != null && (items == null || objItems != null)) {
|
||||
SorterObjectArray sorter = new SorterObjectArray(objKeys, objItems, comparer);
|
||||
sorter.Sort(index, length);
|
||||
} else {
|
||||
SorterGenericArray sorter = new SorterGenericArray(keys, items, comparer);
|
||||
sorter.Sort(index, length);
|
||||
}
|
||||
}
|
||||
|
||||
#region Unsafe array operations
|
||||
@ -678,5 +694,17 @@ namespace System
|
||||
return comparison(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
partial class ArrayEnumerator
|
||||
{
|
||||
public Object Current {
|
||||
get {
|
||||
if (_index < 0) throw new InvalidOperationException (SR.InvalidOperation_EnumNotStarted);
|
||||
if (_index >= _endIndex) throw new InvalidOperationException (SR.InvalidOperation_EnumEnded);
|
||||
if (_index == 0 && _array.GetType ().GetElementType ().IsPointer) throw new NotSupportedException ("Type is not supported");
|
||||
return _array.GetValueImpl(_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -495,8 +495,11 @@ namespace System
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
/* same implementation as CoreCLR */
|
||||
return GetType ().GetHashCode ();
|
||||
MethodInfo m;
|
||||
|
||||
m = Method;
|
||||
|
||||
return (m != null ? m.GetHashCode () : GetType ().GetHashCode ()) ^ (m_target != null ? m_target.GetHashCode () : 0);
|
||||
}
|
||||
|
||||
protected virtual MethodInfo GetMethodImpl ()
|
||||
|
Reference in New Issue
Block a user