} // GetTheSingleInstance Method private void InitializeOnFirstUse ( SyncRoot ps_srCriticalSection , OperatingParametersCollection<T, U> operatingParametersCollection ) { lock ( ps_srCriticalSection ) { } // lock ( ps_srCriticalSection ) } // private void InitializeOnFirstUse
} // OperatingParameters constructor /// <summary> /// Access to the single instance is gated through this method, which is /// called as needed to get references, so that the parameters need not /// be passed around or stored in a global variable. /// </summary> /// <param name="psettingsPropertyValueCollection"> /// Pass a reference to a System.Configuration.SettingsPropertyCollection /// collection from which to obtain default values. /// </param> /// <param name="pstrDisplayNameTemplate"> /// This paramter specifies a template from which to construct the name /// of a managed string resource in the calling assembly to use as the /// display name. If no such string exists, the InternalName property is /// the display name. Likewise, if this string is a null reference or /// the empty string, the InternalName property is the display name. /// </param> /// <param name="penmDefaultParameterSource"> /// Specify the member of the ParameterSource, generic type U, /// enumeration with which to mark the object if the ApplicationSettings /// collection includes a default value. /// /// Please <see cref="OperatingParametersCollection{T, U}"/> for more /// details. /// </param> /// <returns> /// Unless something causes it to fail, the return value is reference to /// a fully initialized object, ready to be loaded with parameters. /// </returns> public static OperatingParametersCollection<T , U> GetTheSingleInstance ( System.Configuration.SettingsPropertyCollection psettingsPropertyValueCollection , string pstrDisplayNameTemplate , U penmDefaultParameterSource ) { OperatingParametersCollection<T , U> rtheOperatingParametersCollection = null; lock ( s_srCriticalSection ) { // Make this call thread-safe. rtheOperatingParametersCollection = s_genTheOnlyInstance; rtheOperatingParametersCollection.InitiaalizeInstance ( psettingsPropertyValueCollection , pstrDisplayNameTemplate , penmDefaultParameterSource ); } // lock ( s_srCriticalSection ) return rtheOperatingParametersCollection; } // GetTheSingleInstance Method