internal static void SetDirect(AbstractConfiguration config) { lock (m_ClassLock) { if (m_Instance != null) { // Transfer properties which are not in conflict with new configuration foreach (var key in m_Instance.Keys) { var value = m_Instance.GetProperty(key); if (value != null && !config.ContainsKey(key)) { config.SetProperty(key, value); } } // Transfer listeners foreach (var handler in m_Instance.ConfigurationChangedEventHandlers) { if (handler.Method.DeclaringType == typeof(DynamicProperty)) { // No need to transfer the fast property listener as it should be set later // with the new configuration continue; } config.ConfigurationChanged += handler; } } RemoveDefaultConfiguration(); m_Instance = config; m_CustomConfigurationInstalled = true; } }
/// <summary> /// Check if the configuration is empty. /// </summary> /// <param name="key">The key whose presence in this configuration is to be tested</param> /// <returns><code>true</code> if the configuration contains a value for this key, <code>false</code> otherwise</returns> public override bool ContainsKey(string key) { return(m_OverrideProperties.ContainsKey(key) || m_Configurations.Any(c => c.ContainsKey(key))); }