System/PCL: Implement HttpWebRequest.SupportsCookieContainer, WebRequest.CreateHttp...
[mono.git] / mcs / class / System / System.Collections.Generic / SortedSet.cs
index 75b81571b149fa26ec9768fe53c82ff0add75e82..6c1943955bd8f3f1684e06593458194ba97f8263 100644 (file)
@@ -3,8 +3,10 @@
 //
 // Authors:
 //  Jb Evain  <jbevain@novell.com>
+//  Marek Safar (marek.safar@gmail.com)
 //
 // Copyright (C) 2010 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -319,6 +321,11 @@ namespace System.Collections.Generic {
                [MonoLimitation ("Isn't O(n) when other is SortedSet<T>")]
                public void ExceptWith (IEnumerable<T> other)
                {
+                       if (other == this) {
+                               Clear ();
+                               return;
+                       }
+
                        CheckArgumentNotNull (other, "other");
                        foreach (T item in other)
                                Remove (item);
@@ -513,6 +520,11 @@ namespace System.Collections.Generic {
                [MonoLimitation ("Isn't O(n) when other is SortedSet<T>")]
                public void SymmetricExceptWith (IEnumerable<T> other)
                {
+                       if (other == this) {
+                               Clear ();
+                               return;
+                       }
+
                        SortedSet<T> that_minus_this = new SortedSet<T> (Comparer);
 
                        // compute this - that and that - this in parallel
@@ -542,12 +554,7 @@ namespace System.Collections.Generic {
                {
                        Add (item);
                }
-
-               void ICollection<T>.CopyTo (T [] array, int index)
-               {
-                       CopyTo (array, index, Count);
-               }
-
+               
                bool ICollection<T>.IsReadOnly {
                        get { return false; }
                }