Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / ProviderCollection.cs / 1305376 / ProviderCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Configuration.Provider { using System.Collections; using System.Collections.Specialized; using System.Runtime.Serialization; ////// public class ProviderCollection : IEnumerable, ICollection //, ICloneable { private Hashtable _Hashtable = null; private bool _ReadOnly = false; //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public ProviderCollection() { _Hashtable = new Hashtable(10, StringComparer.OrdinalIgnoreCase); } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public virtual void Add(ProviderBase provider) { if (_ReadOnly) throw new NotSupportedException(SR.GetString(SR.CollectionReadOnly)); if (provider == null) throw new ArgumentNullException("provider"); if (provider.Name == null || provider.Name.Length < 1) throw new ArgumentException(SR.GetString(SR.Config_provider_name_null_or_empty)); _Hashtable.Add(provider.Name, provider); } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public void Remove(string name) { if (_ReadOnly) throw new NotSupportedException(SR.GetString(SR.CollectionReadOnly)); _Hashtable.Remove(name); } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public ProviderBase this[string name] { get { return _Hashtable[name] as ProviderBase; } } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public IEnumerator GetEnumerator() { return _Hashtable.Values.GetEnumerator(); } //public object Clone(){ // return new ProviderCollection(_Indices, _Values); //} //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public void SetReadOnly() { if (_ReadOnly) return; _ReadOnly = true; } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public void Clear() { if (_ReadOnly) throw new NotSupportedException(SR.GetString(SR.CollectionReadOnly)); _Hashtable.Clear(); } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // ICollection interface public int Count { get { return _Hashtable.Count; }} public bool IsSynchronized { get { return false; } } public object SyncRoot { get { return this; } } public void CopyTo(ProviderBase[] array, int index) { ((ICollection) this).CopyTo(array, index); } void ICollection.CopyTo(Array array, int index) { _Hashtable.Values.CopyTo(array, index); } #if UNUSED_CODE ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// private ProviderCollection(Hashtable h) { _Hashtable = (Hashtable)h.Clone(); } #endif } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BamlReader.cs
- PeerHelpers.cs
- AnchoredBlock.cs
- KnownBoxes.cs
- XmlDataSourceView.cs
- ServiceSecurityAuditElement.cs
- XmlWhitespace.cs
- ServiceOperationDetailViewControl.cs
- CompatibleIComparer.cs
- WindowsFormsSectionHandler.cs
- ListenerPerfCounters.cs
- MulticastOption.cs
- FixedFindEngine.cs
- BooleanConverter.cs
- BufferedOutputStream.cs
- CollectionConverter.cs
- DataGridView.cs
- IndexedEnumerable.cs
- ElementNotAvailableException.cs
- SqlUtils.cs
- wgx_exports.cs
- BooleanFunctions.cs
- WebPartsSection.cs
- TextBox.cs
- PrefixHandle.cs
- ElementProxy.cs
- XmlCountingReader.cs
- TypefaceMetricsCache.cs
- Span.cs
- AsnEncodedData.cs
- StyleXamlParser.cs
- ServiceManager.cs
- listitem.cs
- DoubleCollectionConverter.cs
- WindowsFormsSynchronizationContext.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- UIElement3D.cs
- ValidationPropertyAttribute.cs
- AssemblyName.cs
- ManifestSignedXml.cs
- QueryAsyncResult.cs
- HttpApplication.cs
- AuthenticationModuleElement.cs
- SqlDataSourceCommandEventArgs.cs
- AssemblyName.cs
- ListViewGroupItemCollection.cs
- Profiler.cs
- AuthenticationService.cs
- EdmError.cs
- safePerfProviderHandle.cs
- MessageFault.cs
- RelationshipConverter.cs
- FormsIdentity.cs
- TableLayoutCellPaintEventArgs.cs
- DbConnectionStringBuilder.cs
- ObjectViewListener.cs
- CodeChecksumPragma.cs
- ActivityXRefPropertyEditor.cs
- BitmapEffectCollection.cs
- CapacityStreamGeometryContext.cs
- WorkflowIdleBehavior.cs
- ActivationArguments.cs
- ArrayExtension.cs
- SRGSCompiler.cs
- CodeDomLoader.cs
- httpapplicationstate.cs
- BooleanConverter.cs
- AuthenticationService.cs
- TableItemPatternIdentifiers.cs
- DateTimeParse.cs
- DesignerCalendarAdapter.cs
- VisualTreeUtils.cs
- ScrollEvent.cs
- EditorServiceContext.cs
- TypeResolver.cs
- RawStylusInput.cs
- SQLDecimal.cs
- ZeroOpNode.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- StructuredTypeEmitter.cs
- DocumentReference.cs
- ObjectListCommand.cs
- GridView.cs
- DataKey.cs
- QueryGenerator.cs
- EntityDataSourceContainerNameConverter.cs
- EdmToObjectNamespaceMap.cs
- CacheDependency.cs
- RootBuilder.cs
- FixedSOMContainer.cs
- TextRangeBase.cs
- CompilerResults.cs
- FixedPageAutomationPeer.cs
- ErrorReporting.cs
- RegistryKey.cs
- RecommendedAsConfigurableAttribute.cs
- arabicshape.cs
- _SingleItemRequestCache.cs
- ToolStripInSituService.cs
- Binding.cs