[Mono-dev] [PATCH] System.Configuration/ClientConfigurationSystem.cs

Konstantin Triger kostat at mainsoft.com
Tue Feb 5 05:05:00 EST 2008


Hello all,

This is a small perf refactoring ensuring the Configuration object for an exe is initialized only once.
Please approve.

Index: System.Configuration/ClientConfigurationSystem.cs
===================================================================
--- System.Configuration/ClientConfigurationSystem.cs   (revision 94855)
+++ System.Configuration/ClientConfigurationSystem.cs   (working copy)
@@ -36,15 +36,20 @@

        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;


Regards,
Konstantin Triger




More information about the Mono-devel-list mailing list