Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Configuration / System / Configuration / ProviderCollection.cs / 1 / 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.] ///// 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
- EntityDataSourceChangingEventArgs.cs
- Group.cs
- StreamUpgradeAcceptor.cs
- OperationAbortedException.cs
- ProfilePropertyMetadata.cs
- SQLDecimal.cs
- OdbcConnection.cs
- ComplexBindingPropertiesAttribute.cs
- TraceUtility.cs
- UxThemeWrapper.cs
- IHttpResponseInternal.cs
- TableLayoutPanelDesigner.cs
- HttpCapabilitiesSectionHandler.cs
- CommandHelpers.cs
- ListView.cs
- RawMouseInputReport.cs
- ObjectDataSourceMethodEventArgs.cs
- ConfigurationValue.cs
- ReadOnlyMetadataCollection.cs
- CodeDomLocalizationProvider.cs
- figurelengthconverter.cs
- CheckBoxField.cs
- DataGridViewMethods.cs
- IconConverter.cs
- HelpProvider.cs
- FlowDocument.cs
- TextElementEnumerator.cs
- HttpCookiesSection.cs
- DocumentViewerAutomationPeer.cs
- AdapterDictionary.cs
- DataGridViewCellCancelEventArgs.cs
- RelatedEnd.cs
- Transform3D.cs
- ControlHelper.cs
- URL.cs
- HighContrastHelper.cs
- SendMessageRecord.cs
- BaseUriHelper.cs
- BuildProvider.cs
- CacheDependency.cs
- OracleConnection.cs
- DiagnosticTrace.cs
- HostProtectionException.cs
- PropertyChangedEventArgs.cs
- SqlClientPermission.cs
- PersonalizationEntry.cs
- Bitmap.cs
- CaseInsensitiveComparer.cs
- DbParameterHelper.cs
- KnownTypeHelper.cs
- File.cs
- SymDocumentType.cs
- ping.cs
- HttpCapabilitiesBase.cs
- SiteOfOriginContainer.cs
- TextTreeFixupNode.cs
- Deflater.cs
- ExpressionEditorAttribute.cs
- AnnotationHelper.cs
- CodeObjectCreateExpression.cs
- GlyphRunDrawing.cs
- XPathAxisIterator.cs
- ParagraphVisual.cs
- RangeExpression.cs
- ClientFormsIdentity.cs
- TransformationRules.cs
- ToolboxComponentsCreatedEventArgs.cs
- PointHitTestParameters.cs
- MeasureData.cs
- RowToParametersTransformer.cs
- XmlIlVisitor.cs
- WrappedIUnknown.cs
- EventLogPermissionAttribute.cs
- DispatcherExceptionEventArgs.cs
- UrlMappingsModule.cs
- PassportPrincipal.cs
- GPPOINTF.cs
- DataSourceProvider.cs
- CounterCreationData.cs
- AdapterUtil.cs
- _LocalDataStore.cs
- TextRange.cs
- BoolExpression.cs
- _ShellExpression.cs
- SharedHttpTransportManager.cs
- PageCatalogPart.cs
- CorrelationHandle.cs
- AssociationType.cs
- SchemaDeclBase.cs
- DiscoveryEndpointElement.cs
- ListViewInsertedEventArgs.cs
- CodeParameterDeclarationExpressionCollection.cs
- SerializationBinder.cs
- TextDecorationCollectionConverter.cs
- ExpressionVisitorHelpers.cs
- SafeHandles.cs
- ApplicationException.cs
- FormViewInsertEventArgs.cs
- ReadOnlyDictionary.cs
- Freezable.cs