summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Collections/Generic/List.cs
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2017-02-10 20:35:12 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2017-02-10 20:35:12 +0900
commit4b11dc566a5bbfa1378d6266525c281b028abcc8 (patch)
treeb48831a898906734f8884d08b6e18f1144ee2b82 /src/mscorlib/src/System/Collections/Generic/List.cs
parentdb20f3f1bb8595633a7e16c8900fd401a453a6b5 (diff)
downloadcoreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.gz
coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.bz2
coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.zip
Imported Upstream version 1.0.0.9910upstream/1.0.0.9910
Diffstat (limited to 'src/mscorlib/src/System/Collections/Generic/List.cs')
-rw-r--r--src/mscorlib/src/System/Collections/Generic/List.cs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mscorlib/src/System/Collections/Generic/List.cs b/src/mscorlib/src/System/Collections/Generic/List.cs
index 3e2947f5f9..362e26599d 100644
--- a/src/mscorlib/src/System/Collections/Generic/List.cs
+++ b/src/mscorlib/src/System/Collections/Generic/List.cs
@@ -20,7 +20,6 @@ namespace System.Collections.Generic {
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Collections.ObjectModel;
- using System.Security.Permissions;
// Implements a variable-size List that uses an array of objects to store the
// elements. A List has a capacity, which is the allocated length
@@ -927,7 +926,9 @@ namespace System.Collections.Generic {
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
Contract.EndContractBlock();
- Array.Reverse(_items, index, count);
+ if (count > 1) {
+ Array.Reverse(_items, index, count);
+ }
_version++;
}
@@ -966,7 +967,9 @@ namespace System.Collections.Generic {
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
Contract.EndContractBlock();
- Array.Sort<T>(_items, index, count, comparer);
+ if (count > 1) {
+ Array.Sort<T>(_items, index, count, comparer);
+ }
_version++;
}
@@ -976,9 +979,10 @@ namespace System.Collections.Generic {
}
Contract.EndContractBlock();
- if( _size > 0) {
+ if (_size > 1) {
ArraySortHelper<T>.Sort(_items, 0, _size, comparison);
}
+ _version++;
}
// ToArray returns an array containing the contents of the List.