diff options
author | Benoit Foucher <benoit@zeroc.com> | 2012-04-25 11:19:13 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2012-04-25 11:19:13 +0200 |
commit | 7e874613ff22bedf988273b51a15ab937f01169f (patch) | |
tree | 115a92a902f80fcc6252c5fac6a957ecc548b82c /cs/src/Ice/ObjectFactoryManager.cs | |
parent | Fixed copyrights (diff) | |
download | ice-7e874613ff22bedf988273b51a15ab937f01169f.tar.bz2 ice-7e874613ff22bedf988273b51a15ab937f01169f.tar.xz ice-7e874613ff22bedf988273b51a15ab937f01169f.zip |
Merged Silverlight support
Diffstat (limited to 'cs/src/Ice/ObjectFactoryManager.cs')
-rw-r--r-- | cs/src/Ice/ObjectFactoryManager.cs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/cs/src/Ice/ObjectFactoryManager.cs b/cs/src/Ice/ObjectFactoryManager.cs index d09ca4b1c3e..8c3970b87b0 100644 --- a/cs/src/Ice/ObjectFactoryManager.cs +++ b/cs/src/Ice/ObjectFactoryManager.cs @@ -10,7 +10,7 @@ namespace IceInternal { - using System.Collections; + using System.Collections.Generic; public sealed class ObjectFactoryManager { @@ -18,8 +18,7 @@ namespace IceInternal { lock(this) { - object o = _factoryMap[id]; - if(o != null) + if(_factoryMap.ContainsKey(id)) { Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException(); ex.id = id; @@ -35,8 +34,7 @@ namespace IceInternal object o = null; lock(this) { - o = _factoryMap[id]; - if(o == null) + if(!_factoryMap.ContainsKey(id)) { Ice.NotRegisteredException ex = new Ice.NotRegisteredException(); ex.id = id; @@ -52,7 +50,9 @@ namespace IceInternal { lock(this) { - return (Ice.ObjectFactory)_factoryMap[id]; + Ice.ObjectFactory factory = null; + _factoryMap.TryGetValue(id, out factory); + return factory; } } @@ -61,17 +61,17 @@ namespace IceInternal // internal ObjectFactoryManager() { - _factoryMap = new Hashtable(); + _factoryMap = new Dictionary<string, Ice.ObjectFactory>(); } internal void destroy() { - Hashtable oldMap = null; + Dictionary<string, Ice.ObjectFactory> oldMap = null; lock(this) { oldMap = _factoryMap; - _factoryMap = new Hashtable(); + _factoryMap = new Dictionary<string, Ice.ObjectFactory>(); } foreach(Ice.ObjectFactory factory in oldMap.Values) @@ -80,7 +80,7 @@ namespace IceInternal } } - private Hashtable _factoryMap; + private Dictionary<string, Ice.ObjectFactory> _factoryMap; } } |