Replace in-place instead of removing/readding
authorStefanos A. <stapostol@gmail.com>
Sun, 3 Nov 2013 11:16:07 +0000 (12:16 +0100)
committerStefanos A. <stapostol@gmail.com>
Sun, 3 Nov 2013 11:16:07 +0000 (12:16 +0100)
There is no reason to remove and readd a Constant in order to replace
it in a ConstantCollection. We can actually do that in-place.

Source/Bind/Utilities.cs

index c0f0fe5b9c899d8074cf3f85b47a86bfb39fc6d6..38335c9246659a43e226c545e092fd9470d99090 100644 (file)
@@ -228,8 +228,7 @@ namespace Bind
                 // keep the first one.
                 if (!String.IsNullOrEmpty(s.ConstantCollection[t.Name].Reference))
                 {
-                    s.ConstantCollection.Remove(t.Name);
-                    s.ConstantCollection.Add(t.Name, t);
+                    s.ConstantCollection[t.Name] = t;
                 }
             }