public ChoObjConfigurable[] ConvertToDistinctArray(ChoObjConfigurable[] objConfigurables) { if (ChoGuard.IsArgumentNotNullOrEmpty(objConfigurables)) { return(objConfigurables); } ChoDictionary <string, ChoObjConfigurable> _distinctObjectConfigurables = new ChoDictionary <string, ChoObjConfigurable>(); foreach (ChoObjConfigurable objConfigurable in objConfigurables) { if (objConfigurable == null) { continue; } if (String.IsNullOrEmpty(objConfigurable.Name)) { continue; } if (_distinctObjectConfigurables.ContainsKey(objConfigurable.Name)) { ChoTrace.Debug(String.Format("Item with {0} key already exists.", objConfigurable.Name)); continue; } _distinctObjectConfigurables.Add(objConfigurable.Name, objConfigurable); } return(_distinctObjectConfigurables.ToValuesArray()); }
private static void DisposeAll() { foreach (ChoIniDocument iniDocument in _iniDocuments.ToValuesArray()) { if (iniDocument == null) { continue; } iniDocument.Dispose(); } _iniDocuments.Clear(); }
private static void DisposeAll() { if (_globalObjectCache != null && _globalObjectCache.Count > 0) { foreach (object obj in _globalObjectCache.ToValuesArray()) { if (obj != null && obj is IDisposable) { ((IDisposable)obj).Dispose(); } } } }
internal virtual void Clear() { if (_childProfiles != null) { lock (_childProfiles.SyncRoot) { foreach (IChoProfile profile in _childProfiles.ToValuesArray()) { profile.Dispose(); _Remove(profile); } } } }
public static void DisposeAll() { lock (MemberProfileCache.SyncRoot) { foreach (IChoProfile profile in MemberProfileCache.ToValuesArray()) { //SetAsNotDisposed(profile, true); if (profile is IDisposable) { ((IDisposable)profile).Dispose(); } } MemberProfileCache.Clear(); } }
//[ChoAppDomainUnloadMethod("Disposing all profile objects...")] public static void DisposeAll() { lock (MemberProfileCache.SyncRoot) { foreach (IChoProfile profile in MemberProfileCache.ToValuesArray()) { //SetAsNotDisposed(profile, true); if (profile is IDisposable) { ((IDisposable)profile).Dispose(); } } MemberProfileCache.Clear(); } lock (_profileCacheLock) { if (_profileCache != null) { _profileCache.ForEach((keyValue) => keyValue.Value.Dispose()); _profileCache.Clear(); } } }
public virtual void OnConfigurationStateChanged(object cmdInstruction, object tag) { try { if (_eventHandlerList != null) { int counter = 0; WaitHandle[] handles = new WaitHandle[_eventHandlerList.Count]; ChoConfigurationStateChangedEventArgs eventData = EventData; foreach (ChoConfigurationStateChangedEventHandler callback in _eventHandlerList.ToValuesArray()) { if (callback != null) { handles[counter++] = callback.BeginInvoke(this, new ChoConfigurationStateChangedEventArgs(_configsectionName, cmdInstruction, tag), null, null).AsyncWaitHandle; } } WaitHandle.WaitAll(handles); } } catch (Exception ex) { ChoTrace.Write(ex); } }
public static void Cleanup() { if (_dictService != null) { foreach (IChoConfigurationChangeWatcher configurationChangeWatcher in _dictService.ToValuesArray()) { if (configurationChangeWatcher != null) { configurationChangeWatcher.StopWatching(); } } _dictService.Clear(); } }