Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- webbrowsersite.cs
- DataGridViewButtonCell.cs
- QueryAccessibilityHelpEvent.cs
- LexicalChunk.cs
- XmlUtilWriter.cs
- CompiledIdentityConstraint.cs
- Trustee.cs
- List.cs
- CaseInsensitiveHashCodeProvider.cs
- VectorAnimationUsingKeyFrames.cs
- DefaultBinder.cs
- ZeroOpNode.cs
- TemplateKeyConverter.cs
- Tool.cs
- ImportCatalogPart.cs
- DrawingGroup.cs
- SqlReorderer.cs
- ExpressionBindingCollection.cs
- PropertyKey.cs
- XmlAnyElementAttributes.cs
- RNGCryptoServiceProvider.cs
- EntityDataSourceWrapper.cs
- DateTimeParse.cs
- InitializationEventAttribute.cs
- Schema.cs
- StorageBasedPackageProperties.cs
- CodeGeneratorOptions.cs
- BroadcastEventHelper.cs
- DynamicExpression.cs
- MenuAutomationPeer.cs
- CodeDomConfigurationHandler.cs
- SQLInt64Storage.cs
- CalculatedColumn.cs
- SQLMoneyStorage.cs
- Geometry.cs
- Calendar.cs
- LiteralControl.cs
- ISO2022Encoding.cs
- NaturalLanguageHyphenator.cs
- MediaElement.cs
- DeadCharTextComposition.cs
- TemporaryBitmapFile.cs
- SingleKeyFrameCollection.cs
- XmlName.cs
- CodeGotoStatement.cs
- HelpProvider.cs
- ImageClickEventArgs.cs
- MessageProperties.cs
- FormsAuthenticationTicket.cs
- GenericUI.cs
- SimplePropertyEntry.cs
- VisualBrush.cs
- SelectedDatesCollection.cs
- SHA384.cs
- SecurityUtils.cs
- updatecommandorderer.cs
- GregorianCalendar.cs
- WebServiceMethodData.cs
- odbcmetadatacollectionnames.cs
- HttpConfigurationSystem.cs
- BinaryFormatterWriter.cs
- SafeBitVector32.cs
- AppManager.cs
- PolicyLevel.cs
- ItemDragEvent.cs
- CommandBindingCollection.cs
- KeyGestureConverter.cs
- ProjectionCamera.cs
- SoapAttributeOverrides.cs
- CustomErrorsSectionWrapper.cs
- ReadWriteObjectLock.cs
- LicFileLicenseProvider.cs
- Exceptions.cs
- Switch.cs
- _UncName.cs
- ReferenceConverter.cs
- EventRoute.cs
- AddInServer.cs
- WebPartAuthorizationEventArgs.cs
- SafeNativeMethods.cs
- XmlLinkedNode.cs
- TargetException.cs
- WebPartEditorApplyVerb.cs
- ImageIndexEditor.cs
- TemplateBaseAction.cs
- SecurityElement.cs
- StrongNameIdentityPermission.cs
- ByteStack.cs
- Soap.cs
- PreProcessInputEventArgs.cs
- RichTextBoxAutomationPeer.cs
- SqlVersion.cs
- ColorDialog.cs
- TreeView.cs
- PerformanceCounterPermissionEntry.cs
- ListBox.cs
- DynamicMetaObjectBinder.cs
- PointAnimationUsingKeyFrames.cs
- IntranetCredentialPolicy.cs
- HScrollProperties.cs