projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #733 from amoiseev-softheme/bugfix/monofix
[mono.git]
/
mcs
/
class
/
System
/
System.Collections.Generic
/
Stack.cs
diff --git
a/mcs/class/System/System.Collections.Generic/Stack.cs
b/mcs/class/System/System.Collections.Generic/Stack.cs
index 5fa60de093a33746be0a46436f1c58dd2eb83e4f..4a693549b5f6c8636fd2824a3590b6bbf22d17b8 100644
(file)
--- a/
mcs/class/System/System.Collections.Generic/Stack.cs
+++ b/
mcs/class/System/System.Collections.Generic/Stack.cs
@@
-31,14
+31,16
@@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.Runtime.InteropServices;
using System;
using System.Runtime.InteropServices;
+using System.Diagnostics;
namespace System.Collections.Generic
{
[ComVisible (false)]
[Serializable]
namespace System.Collections.Generic
{
[ComVisible (false)]
[Serializable]
+ [DebuggerDisplay ("Count={Count}")]
+ [DebuggerTypeProxy (typeof (CollectionDebuggerView))]
public class Stack <T> : IEnumerable <T>, ICollection, IEnumerable
{
T [] _array;
public class Stack <T> : IEnumerable <T>, ICollection, IEnumerable
{
T [] _array;
@@
-51,12
+53,12
@@
namespace System.Collections.Generic
{
}
{
}
- public Stack (int c
ount
)
+ public Stack (int c
apacity
)
{
{
- if (c
ount
< 0)
- throw new ArgumentOutOfRangeException ("c
ount
");
+ if (c
apacity
< 0)
+ throw new ArgumentOutOfRangeException ("c
apacity
");
- _array = new T [c
ount
];
+ _array = new T [c
apacity
];
}
public Stack (IEnumerable <T> collection)
}
public Stack (IEnumerable <T> collection)
@@
-85,17
+87,22
@@
namespace System.Collections.Generic
_version ++;
}
_version ++;
}
- public bool Contains (T
t
)
+ public bool Contains (T
item
)
{
{
- return _array != null && Array.IndexOf (_array,
t
, 0, _size) != -1;
+ return _array != null && Array.IndexOf (_array,
item
, 0, _size) != -1;
}
}
- public void CopyTo (T []
dest, int id
x)
+ public void CopyTo (T []
array, int arrayInde
x)
{
{
+ if (array == null)
+ throw new ArgumentNullException ("array");
+ if (arrayIndex < 0)
+ throw new ArgumentOutOfRangeException ("idx");
+
// this gets copied in the order that it is poped
if (_array != null) {
// this gets copied in the order that it is poped
if (_array != null) {
- Array.Copy (_array, 0,
dest, id
x, _size);
- Array.Reverse (
dest, id
x, _size);
+ Array.Copy (_array, 0,
array, arrayInde
x, _size);
+ Array.Reverse (
array, arrayInde
x, _size);
}
}
}
}
@@
-119,14
+126,14
@@
namespace System.Collections.Generic
return popped;
}
return popped;
}
- public void Push (T
t
)
+ public void Push (T
item
)
{
{
- if (_
size == 0
|| _size == _array.Length)
+ if (_
array == null
|| _size == _array.Length)
Array.Resize <T> (ref _array, _size == 0 ? INITIAL_SIZE : 2 * _size);
_version ++;
Array.Resize <T> (ref _array, _size == 0 ? INITIAL_SIZE : 2 * _size);
_version ++;
- _array [_size++] =
t
;
+ _array [_size++] =
item
;
}
public T [] ToArray ()
}
public T [] ToArray ()
@@
-159,7
+166,7
@@
namespace System.Collections.Generic
{
try {
if (_array != null) {
{
try {
if (_array != null) {
-
_array.CopyTo (dest, idx
);
+
Array.Copy (_array, 0, dest, idx, _size
);
Array.Reverse (dest, idx, _size);
}
} catch (ArrayTypeMismatchException) {
Array.Reverse (dest, idx, _size);
}
} catch (ArrayTypeMismatchException) {
@@
-206,7
+213,7
@@
namespace System.Collections.Generic
// broken.
public void Dispose ()
{
// broken.
public void Dispose ()
{
- idx =
NOT_START
ED;
+ idx =
FINISH
ED;
}
public bool MoveNext ()
}
public bool MoveNext ()
@@
-244,4
+251,3
@@
namespace System.Collections.Generic
}
}
}
}
}
}
-#endif