Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- DataGridTemplateColumn.cs
- ExtentCqlBlock.cs
- AQNBuilder.cs
- XXXInfos.cs
- ImageSource.cs
- NetMsmqBinding.cs
- GenericUriParser.cs
- TogglePatternIdentifiers.cs
- AssemblyResourceLoader.cs
- Aggregates.cs
- EntityDataSourceQueryBuilder.cs
- ApplyImportsAction.cs
- wgx_commands.cs
- WsdlImporterElementCollection.cs
- SafeArchiveContext.cs
- ImmutableAssemblyCacheEntry.cs
- ScrollItemPattern.cs
- FixUp.cs
- GenerateTemporaryTargetAssembly.cs
- NetSectionGroup.cs
- XPathCompileException.cs
- ThreadStartException.cs
- TextElement.cs
- CodeSnippetStatement.cs
- EntityDataSourceContextCreatedEventArgs.cs
- Vector3D.cs
- SerializableAuthorizationContext.cs
- XmlStringTable.cs
- SqlBulkCopyColumnMappingCollection.cs
- ToRequest.cs
- RelationshipManager.cs
- VerticalAlignConverter.cs
- RepeaterItemCollection.cs
- XsdBuildProvider.cs
- Buffer.cs
- MetadataUtilsSmi.cs
- XPathNavigatorKeyComparer.cs
- HostedTransportConfigurationBase.cs
- NominalTypeEliminator.cs
- CounterSetInstance.cs
- ExtenderProvidedPropertyAttribute.cs
- SplineQuaternionKeyFrame.cs
- Int32.cs
- CodeCatchClauseCollection.cs
- RankException.cs
- RepeaterItemCollection.cs
- DesignOnlyAttribute.cs
- WebResourceUtil.cs
- UnsafeNativeMethods.cs
- IPipelineRuntime.cs
- Restrictions.cs
- RemotingException.cs
- Image.cs
- EventProviderWriter.cs
- XamlHostingSectionGroup.cs
- DetailsView.cs
- ParallelSeparator.xaml.cs
- GetPageCompletedEventArgs.cs
- AutoResizedEvent.cs
- ReadOnlyDataSourceView.cs
- HiddenField.cs
- LookupNode.cs
- PolyQuadraticBezierSegment.cs
- DiscoveryDocumentLinksPattern.cs
- TdsParameterSetter.cs
- SecurityChannelListener.cs
- GridViewDeletedEventArgs.cs
- Variant.cs
- ConfigXmlCDataSection.cs
- ObjectTag.cs
- _IPv4Address.cs
- MimeTypePropertyAttribute.cs
- SafeLocalMemHandle.cs
- DefaultIfEmptyQueryOperator.cs
- VirtualPath.cs
- GradientStop.cs
- GridSplitterAutomationPeer.cs
- SafeBitVector32.cs
- InvokePattern.cs
- ProcessHost.cs
- KeyTimeConverter.cs
- ResourceAttributes.cs
- ActivityBuilderXamlWriter.cs
- PeerNearMe.cs
- RelatedEnd.cs
- ColumnCollection.cs
- EntityCommand.cs
- DiscoveryServiceExtension.cs
- BaseCodePageEncoding.cs
- _UncName.cs
- TransactionScope.cs
- SessionPageStateSection.cs
- DispatchWrapper.cs
- HashSetDebugView.cs
- SoapCodeExporter.cs
- ImplicitInputBrush.cs
- ListControl.cs
- FilterableAttribute.cs
- GeometryValueSerializer.cs
- WrapPanel.cs