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
- ErrorTableItemStyle.cs
- WindowsGraphicsWrapper.cs
- DataGridViewRowsAddedEventArgs.cs
- UndoUnit.cs
- TypeNameConverter.cs
- StreamAsIStream.cs
- SplitContainerDesigner.cs
- HttpConfigurationContext.cs
- DataDocumentXPathNavigator.cs
- WindowsBrush.cs
- ObjectDataSourceWizardForm.cs
- ParentQuery.cs
- IntegerValidator.cs
- SecurityResources.cs
- GridItemPattern.cs
- TextParentUndoUnit.cs
- Repeater.cs
- EnvelopedSignatureTransform.cs
- Bits.cs
- ParentQuery.cs
- UIAgentCrashedException.cs
- UniqueConstraint.cs
- FieldBuilder.cs
- SqlOuterApplyReducer.cs
- CodeIterationStatement.cs
- XmlSchemaDocumentation.cs
- Vector3DCollection.cs
- HttpWriter.cs
- SpecularMaterial.cs
- DocumentViewerAutomationPeer.cs
- ReadOnlyDataSourceView.cs
- ListViewItem.cs
- SecurityContextSecurityTokenResolver.cs
- ResolveCriteria11.cs
- ExpressionBuilder.cs
- QualifierSet.cs
- TextEndOfSegment.cs
- KeyValueConfigurationElement.cs
- TraceProvider.cs
- GetFileNameResult.cs
- SQLRoleProvider.cs
- RadioButtonStandardAdapter.cs
- SQLInt16Storage.cs
- SelectQueryOperator.cs
- UnionExpr.cs
- DataContract.cs
- SqlBuilder.cs
- MetadataItemSerializer.cs
- XamlToRtfWriter.cs
- PeerContact.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- NativeMethods.cs
- DataGridViewTextBoxEditingControl.cs
- Thread.cs
- PropertyEmitter.cs
- ListViewGroupItemCollection.cs
- PlainXmlSerializer.cs
- SubMenuStyle.cs
- ObjectViewListener.cs
- Button.cs
- UnauthorizedWebPart.cs
- SqlDataSourceEnumerator.cs
- ColorTransform.cs
- NativeWindow.cs
- DateBoldEvent.cs
- EventDescriptorCollection.cs
- SourceSwitch.cs
- XmlFormatWriterGenerator.cs
- ApplicationSecurityInfo.cs
- EventLogPermissionEntry.cs
- RequestUriProcessor.cs
- PropertyEmitterBase.cs
- EventDescriptorCollection.cs
- FlowLayoutSettings.cs
- NotFiniteNumberException.cs
- RequestDescription.cs
- TextProperties.cs
- BitStack.cs
- ExpressionEditor.cs
- BitmapMetadataEnumerator.cs
- HandlerWithFactory.cs
- DefaultIfEmptyQueryOperator.cs
- MenuAdapter.cs
- ContourSegment.cs
- AppModelKnownContentFactory.cs
- DataObjectAttribute.cs
- FixedHyperLink.cs
- PropagatorResult.cs
- CodeGenerator.cs
- XmlRawWriter.cs
- UIPermission.cs
- GenericWebPart.cs
- XmlILAnnotation.cs
- XPathItem.cs
- StoreConnection.cs
- LiteralDesigner.cs
- MiniMapControl.xaml.cs
- RenderOptions.cs
- DependencyObject.cs
- DNS.cs