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 / NameValueConfigurationCollection.cs / 1 / NameValueConfigurationCollection.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
* ImmutableCollections
*
* Copyright (c) 2004 Microsoft Corporation
*/
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Net;
using System.Configuration;
//
// This file contains configuration collections that are used by multiple sections
//
namespace System.Configuration
{
[ConfigurationCollection(typeof(NameValueConfigurationElement))]
public sealed class NameValueConfigurationCollection : ConfigurationElementCollection
{
private static ConfigurationPropertyCollection _properties;
static NameValueConfigurationCollection() {
// Property initialization
_properties = new ConfigurationPropertyCollection();
}
protected internal override ConfigurationPropertyCollection Properties {
get {
return _properties;
}
}
//
// Constructor
//
public NameValueConfigurationCollection()
{
}
//
// Accessors
//
public new NameValueConfigurationElement this[string name]
{
get
{
return (NameValueConfigurationElement) BaseGet(name);
}
set
{
int index = -1; // append by default
NameValueConfigurationElement tempElement = (NameValueConfigurationElement) BaseGet(name);
if (tempElement != null)
{
index = BaseIndexOf(tempElement);
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}
public String[] AllKeys
{
get
{
return StringUtil.ObjectArrayToStringArray(BaseGetAllKeys());
}
}
//
// Methods
//
public void Add(NameValueConfigurationElement nameValue)
{
BaseAdd(nameValue);
}
public void Remove(NameValueConfigurationElement nameValue)
{
if (BaseIndexOf(nameValue) >= 0)
BaseRemove(nameValue.Name);
}
public void Remove(string name)
{
BaseRemove(name);
}
public void Clear()
{
BaseClear();
}
protected override ConfigurationElement CreateNewElement()
{
return new NameValueConfigurationElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((NameValueConfigurationElement)element).Name;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
* ImmutableCollections
*
* Copyright (c) 2004 Microsoft Corporation
*/
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Net;
using System.Configuration;
//
// This file contains configuration collections that are used by multiple sections
//
namespace System.Configuration
{
[ConfigurationCollection(typeof(NameValueConfigurationElement))]
public sealed class NameValueConfigurationCollection : ConfigurationElementCollection
{
private static ConfigurationPropertyCollection _properties;
static NameValueConfigurationCollection() {
// Property initialization
_properties = new ConfigurationPropertyCollection();
}
protected internal override ConfigurationPropertyCollection Properties {
get {
return _properties;
}
}
//
// Constructor
//
public NameValueConfigurationCollection()
{
}
//
// Accessors
//
public new NameValueConfigurationElement this[string name]
{
get
{
return (NameValueConfigurationElement) BaseGet(name);
}
set
{
int index = -1; // append by default
NameValueConfigurationElement tempElement = (NameValueConfigurationElement) BaseGet(name);
if (tempElement != null)
{
index = BaseIndexOf(tempElement);
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}
public String[] AllKeys
{
get
{
return StringUtil.ObjectArrayToStringArray(BaseGetAllKeys());
}
}
//
// Methods
//
public void Add(NameValueConfigurationElement nameValue)
{
BaseAdd(nameValue);
}
public void Remove(NameValueConfigurationElement nameValue)
{
if (BaseIndexOf(nameValue) >= 0)
BaseRemove(nameValue.Name);
}
public void Remove(string name)
{
BaseRemove(name);
}
public void Clear()
{
BaseClear();
}
protected override ConfigurationElement CreateNewElement()
{
return new NameValueConfigurationElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((NameValueConfigurationElement)element).Name;
}
}
}
// 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
- ProgressBarRenderer.cs
- ObjectStateEntry.cs
- DataGridSortCommandEventArgs.cs
- SortAction.cs
- UnauthorizedAccessException.cs
- CallbackException.cs
- GeneralTransformGroup.cs
- ProtocolsConfigurationHandler.cs
- ConnectionInterfaceCollection.cs
- CorrelationHandle.cs
- AuthorizationRuleCollection.cs
- AttributeAction.cs
- SqlResolver.cs
- Page.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- UnknownWrapper.cs
- XmlProcessingInstruction.cs
- StrongNameKeyPair.cs
- NavigationHelper.cs
- DataGridViewButtonCell.cs
- HasCopySemanticsAttribute.cs
- ScriptComponentDescriptor.cs
- CFGGrammar.cs
- FontWeightConverter.cs
- dataSvcMapFileLoader.cs
- Converter.cs
- Inline.cs
- ObjectListDataBindEventArgs.cs
- VScrollBar.cs
- LabelLiteral.cs
- Bidi.cs
- SeekStoryboard.cs
- URL.cs
- DirtyTextRange.cs
- MetadataItem.cs
- Msec.cs
- SignedXml.cs
- WebColorConverter.cs
- ViewGenResults.cs
- GridItemPattern.cs
- BaseCodePageEncoding.cs
- DataSetViewSchema.cs
- Invariant.cs
- SiteMapNodeItemEventArgs.cs
- RegexStringValidator.cs
- SelectorItemAutomationPeer.cs
- EntitySetBase.cs
- XmlSchemaInfo.cs
- DictionaryGlobals.cs
- Int32CollectionConverter.cs
- FontFamilyIdentifier.cs
- DoubleAnimationUsingKeyFrames.cs
- SID.cs
- PauseStoryboard.cs
- Schema.cs
- Quaternion.cs
- ConstraintManager.cs
- unsafenativemethodsother.cs
- EntitySetBaseCollection.cs
- ToolStripStatusLabel.cs
- StylusOverProperty.cs
- ReflectionUtil.cs
- Dispatcher.cs
- PackWebResponse.cs
- HtmlAnchor.cs
- StickyNoteHelper.cs
- ProfileProvider.cs
- FormsIdentity.cs
- CustomAttributeBuilder.cs
- CodeTypeMember.cs
- ServiceSecurityAuditElement.cs
- HttpPostedFile.cs
- SemaphoreFullException.cs
- SplineQuaternionKeyFrame.cs
- EntityDataSourceContextCreatedEventArgs.cs
- ConstraintStruct.cs
- TrackingRecordPreFilter.cs
- AutomationInteropProvider.cs
- SerializationStore.cs
- PlatformCulture.cs
- HtmlHistory.cs
- TypeDependencyAttribute.cs
- TcpStreams.cs
- PageThemeCodeDomTreeGenerator.cs
- FunctionCommandText.cs
- GenericTypeParameterBuilder.cs
- InputLanguage.cs
- securitycriticaldata.cs
- UnionCqlBlock.cs
- LocalizableResourceBuilder.cs
- GridViewRowCollection.cs
- Model3D.cs
- ReadOnlyTernaryTree.cs
- SiteMembershipCondition.cs
- ComponentResourceKeyConverter.cs
- PageThemeBuildProvider.cs
- BindingRestrictions.cs
- UdpDiscoveryEndpointProvider.cs
- StackSpiller.Temps.cs
- FormatConvertedBitmap.cs