Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- GlyphsSerializer.cs
- ConfigXmlElement.cs
- ProgressBarBrushConverter.cs
- DataRelationCollection.cs
- ContentHostHelper.cs
- XhtmlBasicLinkAdapter.cs
- ParsedAttributeCollection.cs
- XmlSchemaInfo.cs
- GroupPartitionExpr.cs
- TableCellAutomationPeer.cs
- ManagementClass.cs
- Quaternion.cs
- TextComposition.cs
- EntityDataSourceMemberPath.cs
- ContentTextAutomationPeer.cs
- ScriptMethodAttribute.cs
- IMembershipProvider.cs
- ChangePassword.cs
- Base64Encoder.cs
- DirectionalLight.cs
- SchemaNamespaceManager.cs
- XPathDocumentNavigator.cs
- Constraint.cs
- StoreAnnotationsMap.cs
- ConfigurationErrorsException.cs
- EmptyEnumerable.cs
- ScrollBarRenderer.cs
- RadioButtonBaseAdapter.cs
- XamlSerializationHelper.cs
- OdbcTransaction.cs
- InputEventArgs.cs
- RedirectionProxy.cs
- thaishape.cs
- ITextView.cs
- ISAPIApplicationHost.cs
- AssemblyInfo.cs
- ShutDownListener.cs
- Merger.cs
- WebSysDefaultValueAttribute.cs
- srgsitem.cs
- BitmapEffect.cs
- BindingOperations.cs
- XmlEntityReference.cs
- TableLayoutColumnStyleCollection.cs
- MenuTracker.cs
- LiteralControl.cs
- VirtualPathData.cs
- SearchForVirtualItemEventArgs.cs
- Grammar.cs
- FilePresentation.cs
- LateBoundBitmapDecoder.cs
- Grammar.cs
- HistoryEventArgs.cs
- BinaryParser.cs
- AssemblySettingAttributes.cs
- RootProjectionNode.cs
- RegexFCD.cs
- ScriptRegistrationManager.cs
- XmlSchemaInfo.cs
- ComponentEvent.cs
- SoapElementAttribute.cs
- TypeToStringValueConverter.cs
- RangeEnumerable.cs
- SecurityTokenException.cs
- AuthorizationPolicyTypeElement.cs
- Cloud.cs
- MemoryRecordBuffer.cs
- SpellCheck.cs
- baseshape.cs
- WebPageTraceListener.cs
- ValueCollectionParameterReader.cs
- GridViewDeletedEventArgs.cs
- CommandField.cs
- OleStrCAMarshaler.cs
- XmlHierarchicalEnumerable.cs
- SelectionRange.cs
- NativeMethods.cs
- DesignerDataColumn.cs
- CngAlgorithm.cs
- OdbcDataAdapter.cs
- SubMenuStyle.cs
- ColumnCollection.cs
- ScopedKnownTypes.cs
- Config.cs
- mediaclock.cs
- COM2FontConverter.cs
- ColorConvertedBitmapExtension.cs
- DataSourceHelper.cs
- RectValueSerializer.cs
- Marshal.cs
- ZipIORawDataFileBlock.cs
- WindowsEditBox.cs
- DesignerVerbCollection.cs
- GridItem.cs
- ZipPackage.cs
- DetailsViewCommandEventArgs.cs
- HttpListener.cs
- CategoryGridEntry.cs
- WebPartManagerDesigner.cs
- Encoder.cs