//
//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-
-using System;
-using System.Collections;
using System.Globalization;
+using System.Runtime.InteropServices;
namespace System.Collections {
/// and by index.
/// </summary>
[Serializable]
- [MonoTODO ("Fix serialization compatibility with MS.NET")]
+#if NET_2_0
+ [ComVisible(true)]
+#endif
public class SortedList : IDictionary, ICollection,
IEnumerable, ICloneable {
{
}
+ // LAMESPEC: MSDN docs talk about an InvalidCastException but
+ // I wasn't able to duplicate such a case in the unit tests.
public SortedList (IDictionary d, IComparer comparer)
{
if (d == null)
IDictionaryEnumerator it = d.GetEnumerator ();
while (it.MoveNext ()) {
- if (it.Key is IComparable) {
- Add (it.Key, it.Value);
- } else {
- throw new InvalidCastException("!IComparable");
- }
+ Add (it.Key, it.Value);
}
}
}
if (freeIndx >= 0) {
- if (!overwrite)
- throw new ArgumentException("element already exists");
+ if (!overwrite) {
+ string msg = Locale.GetText ("Key '{0}' already exists in list.", key);
+ throw new ArgumentException (msg);
+ }
table [freeIndx].value = value;
++modificationCount;
return null;
}
- private void InitTable (int capacity)
- {
- InitTable (capacity, false);
- }
-
private void InitTable (int capacity, bool forceSize)
{
if (!forceSize && (capacity < defaultCapacity))