performance: refactor out the Configuration object construction from GetSection(...
authorKonstantin Triger <kostat@mono-cvs.ximian.com>
Thu, 7 Feb 2008 07:15:16 +0000 (07:15 -0000)
committerKonstantin Triger <kostat@mono-cvs.ximian.com>
Thu, 7 Feb 2008 07:15:16 +0000 (07:15 -0000)
svn path=/trunk/mcs/; revision=95121

mcs/class/System.Configuration/System.Configuration/ChangeLog
mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs

index a85c83c2e905a659dc7a9c966fdde4ac8b5f9f70..bb0d5af65632c65789db09003a80bedd1963ea55 100644 (file)
@@ -1,3 +1,8 @@
+2008-02-07  Konstantin Triger <kostat@mainsoft.com>
+
+       * ClientConfigurationSystem.cs: performance: refactor out the Configuration
+               object construction from GetSection() to the ctor.
+
 2008-01-16  Zoltan Varga  <vargaz@gmail.com>
 
        * ConfigurationElement.cs: Allow non-public constructors. Fixes #353554.
index d8d9dec7270e93f74581baa7ff7a098936a6d85a..00e67e6fc519bfff4a3343e6ec765265df83df83 100644 (file)
@@ -36,15 +36,20 @@ namespace System.Configuration {
 
        internal class ClientConfigurationSystem : IInternalConfigSystem
        {
-               object IInternalConfigSystem.GetSection (string configKey)
-               {
+               readonly Configuration cfg;
+
+               public ClientConfigurationSystem () {
                        Assembly a = Assembly.GetEntryAssembly();
                        string exePath = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
             
                        if (a == null && exePath == null)
                                exePath = "";
             
-                       Configuration cfg = ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel.None, a, exePath);
+                       cfg = ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel.None, a, exePath);
+               }
+
+               object IInternalConfigSystem.GetSection (string configKey)
+               {
                        if (cfg == null)
                                return null;