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
- DocumentPageViewAutomationPeer.cs
- MethodBuilder.cs
- CaseStatement.cs
- AnnotationResourceCollection.cs
- TypeDependencyAttribute.cs
- ScrollItemPattern.cs
- DependencyObject.cs
- CompositeFontFamily.cs
- Input.cs
- MenuItemAutomationPeer.cs
- ApplyTemplatesAction.cs
- ProcessHostServerConfig.cs
- DetailsViewDeleteEventArgs.cs
- DictionaryManager.cs
- CollectionViewGroupRoot.cs
- NameTable.cs
- ConfigXmlComment.cs
- TypeLibConverter.cs
- EntityDesignerDataSourceView.cs
- Component.cs
- WebPartChrome.cs
- WebBrowserPermission.cs
- AppDomainResourcePerfCounters.cs
- InputReferenceExpression.cs
- ProviderConnectionPointCollection.cs
- BamlLocalizabilityResolver.cs
- CustomErrorCollection.cs
- QuaternionAnimation.cs
- NavigationService.cs
- ISAPIApplicationHost.cs
- ChangeBlockUndoRecord.cs
- PackageDigitalSignature.cs
- BaseDataList.cs
- UrlAuthFailedErrorFormatter.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- XmlSchemaIdentityConstraint.cs
- DataGridViewLinkColumn.cs
- UiaCoreTypesApi.cs
- ExpanderAutomationPeer.cs
- URLMembershipCondition.cs
- PagesChangedEventArgs.cs
- MethodBody.cs
- StateMachineWorkflow.cs
- ParameterEditorUserControl.cs
- EnumValAlphaComparer.cs
- FormClosingEvent.cs
- PrimitiveXmlSerializers.cs
- ObjectDisposedException.cs
- TextDecoration.cs
- DocumentViewerBase.cs
- LabelLiteral.cs
- SwitchElementsCollection.cs
- NavigationPropertyEmitter.cs
- CookieHandler.cs
- PathData.cs
- ServiceOperationListItem.cs
- ToolStripPanelCell.cs
- Calendar.cs
- ClipboardData.cs
- ComboBox.cs
- LoginDesignerUtil.cs
- NodeFunctions.cs
- LicenseContext.cs
- MemoryStream.cs
- MD5CryptoServiceProvider.cs
- DayRenderEvent.cs
- DataControlField.cs
- DataGridColumnReorderingEventArgs.cs
- WebFaultClientMessageInspector.cs
- CodeSubDirectoriesCollection.cs
- RegexTree.cs
- SafeLocalMemHandle.cs
- Array.cs
- SamlAction.cs
- FormConverter.cs
- HtmlHead.cs
- Hashtable.cs
- EnumUnknown.cs
- ToolStripOverflowButton.cs
- CaseStatement.cs
- DispatcherExceptionFilterEventArgs.cs
- DataSetMappper.cs
- XmlNullResolver.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- Panel.cs
- BindingNavigatorDesigner.cs
- DeclaredTypeElementCollection.cs
- MouseActionValueSerializer.cs
- TemplatedWizardStep.cs
- RadioButtonFlatAdapter.cs
- ToolStripContainer.cs
- XmlDeclaration.cs
- NamespaceMapping.cs
- SoapExtensionTypeElement.cs
- OpCopier.cs
- DrawingCollection.cs
- ShaderEffect.cs
- HtmlTable.cs
- FileDialog.cs
- Translator.cs