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;
///
/// [To be supplied.]
///
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.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Configuration.Provider {
using System.Collections;
using System.Collections.Specialized;
using System.Runtime.Serialization;
///
/// [To be supplied.]
///
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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MultitargetingHelpers.cs
- OleAutBinder.cs
- figurelength.cs
- SystemUdpStatistics.cs
- StorageRoot.cs
- Operand.cs
- ComAdminWrapper.cs
- TreeViewBindingsEditorForm.cs
- coordinatorscratchpad.cs
- SimpleMailWebEventProvider.cs
- SQLUtility.cs
- SystemIPGlobalProperties.cs
- CodeValidator.cs
- CommonGetThemePartSize.cs
- DataDocumentXPathNavigator.cs
- SslStreamSecurityElement.cs
- _ConnectOverlappedAsyncResult.cs
- DataGridViewDataErrorEventArgs.cs
- DataBinding.cs
- DbProviderManifest.cs
- CharEnumerator.cs
- XmlSchemaSubstitutionGroup.cs
- SignatureGenerator.cs
- OleDbParameterCollection.cs
- RegexMatchCollection.cs
- ListItemCollection.cs
- CombinedGeometry.cs
- ActivityIdHeader.cs
- DiscoveryClientDocuments.cs
- XPathNodePointer.cs
- RtfToXamlReader.cs
- CheckPair.cs
- Int32.cs
- XmlWhitespace.cs
- AsyncPostBackTrigger.cs
- HashCodeCombiner.cs
- EdmToObjectNamespaceMap.cs
- XsltContext.cs
- ApplicationServicesHostFactory.cs
- EdmPropertyAttribute.cs
- SQLConvert.cs
- Graph.cs
- ConstraintConverter.cs
- SqlDataSourceFilteringEventArgs.cs
- OracleParameterBinding.cs
- Empty.cs
- SharedPerformanceCounter.cs
- Tag.cs
- BitmapCodecInfoInternal.cs
- XmlNodeList.cs
- IMembershipProvider.cs
- TagNameToTypeMapper.cs
- CommonDialog.cs
- RuntimeHandles.cs
- EntityContainer.cs
- ScrollBarRenderer.cs
- ValuePatternIdentifiers.cs
- HotCommands.cs
- AutoGeneratedFieldProperties.cs
- BasePattern.cs
- ButtonChrome.cs
- MessageFilter.cs
- SoapClientMessage.cs
- FileIOPermission.cs
- ColorConvertedBitmapExtension.cs
- PageContentAsyncResult.cs
- CodeExpressionStatement.cs
- FormClosingEvent.cs
- XmlSchemaSearchPattern.cs
- QueryTask.cs
- BooleanToVisibilityConverter.cs
- ToolStripLabel.cs
- EmptyEnumerable.cs
- OSFeature.cs
- XmlSerializationWriter.cs
- Contracts.cs
- EncodingInfo.cs
- XmlObjectSerializerWriteContextComplex.cs
- RoleManagerModule.cs
- ResizeGrip.cs
- CanonicalFormWriter.cs
- NamedPipeWorkerProcess.cs
- Point3DCollection.cs
- EncodingInfo.cs
- ipaddressinformationcollection.cs
- MSAAEventDispatcher.cs
- DynamicFilterExpression.cs
- HtmlMeta.cs
- DefaultTextStoreTextComposition.cs
- LookupBindingPropertiesAttribute.cs
- UseLicense.cs
- PromptStyle.cs
- DesignTimeTemplateParser.cs
- DataExpression.cs
- TableLayoutPanel.cs
- WindowsStartMenu.cs
- SendingRequestEventArgs.cs
- ClientUtils.cs
- TableLayoutSettings.cs
- TdsValueSetter.cs