Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Serialization / System / Runtime / Serialization / Configuration / ParameterElementCollection.cs / 1305376 / ParameterElementCollection.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.Runtime.Serialization.Configuration
{
using System;
using System.Configuration;
using System.Globalization;
[ConfigurationCollection(typeof(ParameterElement), AddItemName = ConfigurationStrings.Parameter, CollectionType = ConfigurationElementCollectionType.BasicMap)]
public sealed class ParameterElementCollection : ConfigurationElementCollection
{
public ParameterElementCollection()
{
this.AddElementName = ConfigurationStrings.Parameter;
}
public ParameterElement this[int index]
{
get
{
ParameterElement retval = (ParameterElement)BaseGet(index);
return retval;
}
set
{
// Only validate input if config is not Read-Only, otherwise
// let BaseAdd throw appropriate exception
if (!this.IsReadOnly())
{
if (value == null)
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
}
if (BaseGet(index) != null)
{
BaseRemoveAt(index);
}
}
BaseAdd(index, value);
}
}
public void Add(ParameterElement element)
{
// Only validate input if config is not Read-Only, otherwise
// let BaseAdd throw appropriate exception
if (!this.IsReadOnly())
{
if (element == null)
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element");
}
}
BaseAdd(element);
}
public void Clear()
{
BaseClear();
}
public override ConfigurationElementCollectionType CollectionType
{
get { return ConfigurationElementCollectionType.BasicMap; }
}
public bool Contains(string typeName)
{
if (String.IsNullOrEmpty(typeName))
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("typeName");
}
return this.BaseGet(typeName) != null;
}
protected override ConfigurationElement CreateNewElement()
{
ParameterElement retval = new ParameterElement();
return retval;
}
protected override string ElementName
{
get { return ConfigurationStrings.Parameter; }
}
protected override Object GetElementKey(ConfigurationElement element)
{
if (element == null)
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element");
}
return ((ParameterElement)element).identity;
}
public int IndexOf(ParameterElement element)
{
if (element == null)
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element");
}
return BaseIndexOf(element);
}
public void Remove(ParameterElement element)
{
// Only validate input if config is not Read-Only, otherwise
// let BaseRemove throw appropriate exception
if (!this.IsReadOnly())
{
if (element == null)
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element");
}
}
BaseRemove(this.GetElementKey(element));
}
public void RemoveAt(int index)
{
BaseRemoveAt(index);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.Runtime.Serialization.Configuration
{
using System;
using System.Configuration;
using System.Globalization;
[ConfigurationCollection(typeof(ParameterElement), AddItemName = ConfigurationStrings.Parameter, CollectionType = ConfigurationElementCollectionType.BasicMap)]
public sealed class ParameterElementCollection : ConfigurationElementCollection
{
public ParameterElementCollection()
{
this.AddElementName = ConfigurationStrings.Parameter;
}
public ParameterElement this[int index]
{
get
{
ParameterElement retval = (ParameterElement)BaseGet(index);
return retval;
}
set
{
// Only validate input if config is not Read-Only, otherwise
// let BaseAdd throw appropriate exception
if (!this.IsReadOnly())
{
if (value == null)
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
}
if (BaseGet(index) != null)
{
BaseRemoveAt(index);
}
}
BaseAdd(index, value);
}
}
public void Add(ParameterElement element)
{
// Only validate input if config is not Read-Only, otherwise
// let BaseAdd throw appropriate exception
if (!this.IsReadOnly())
{
if (element == null)
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element");
}
}
BaseAdd(element);
}
public void Clear()
{
BaseClear();
}
public override ConfigurationElementCollectionType CollectionType
{
get { return ConfigurationElementCollectionType.BasicMap; }
}
public bool Contains(string typeName)
{
if (String.IsNullOrEmpty(typeName))
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("typeName");
}
return this.BaseGet(typeName) != null;
}
protected override ConfigurationElement CreateNewElement()
{
ParameterElement retval = new ParameterElement();
return retval;
}
protected override string ElementName
{
get { return ConfigurationStrings.Parameter; }
}
protected override Object GetElementKey(ConfigurationElement element)
{
if (element == null)
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element");
}
return ((ParameterElement)element).identity;
}
public int IndexOf(ParameterElement element)
{
if (element == null)
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element");
}
return BaseIndexOf(element);
}
public void Remove(ParameterElement element)
{
// Only validate input if config is not Read-Only, otherwise
// let BaseRemove throw appropriate exception
if (!this.IsReadOnly())
{
if (element == null)
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element");
}
}
BaseRemove(this.GetElementKey(element));
}
public void RemoveAt(int index)
{
BaseRemoveAt(index);
}
}
}
// 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
- DebugView.cs
- SourceSwitch.cs
- Vector3DCollection.cs
- ReferentialConstraintRoleElement.cs
- CommonRemoteMemoryBlock.cs
- TreeSet.cs
- WinInetCache.cs
- MediaScriptCommandRoutedEventArgs.cs
- Fonts.cs
- ArcSegment.cs
- Debug.cs
- EpmTargetPathSegment.cs
- EncoderBestFitFallback.cs
- TreeNodeClickEventArgs.cs
- BinaryKeyIdentifierClause.cs
- VisualTarget.cs
- NativeMethods.cs
- BooleanToVisibilityConverter.cs
- WorkflowViewService.cs
- Annotation.cs
- TraceLevelHelper.cs
- PageThemeBuildProvider.cs
- DesigntimeLicenseContextSerializer.cs
- DataGridViewRowsRemovedEventArgs.cs
- TerminateWorkflow.cs
- OpacityConverter.cs
- ImageList.cs
- UpdatePanel.cs
- ClientRequest.cs
- XmlCollation.cs
- ListBox.cs
- _ListenerRequestStream.cs
- LeaseManager.cs
- GridSplitterAutomationPeer.cs
- ALinqExpressionVisitor.cs
- HybridObjectCache.cs
- ProvideValueServiceProvider.cs
- NotImplementedException.cs
- DiagnosticTrace.cs
- ServiceMetadataBehavior.cs
- CopyCodeAction.cs
- ImageMetadata.cs
- RIPEMD160.cs
- MdImport.cs
- BufferBuilder.cs
- EntitySetBaseCollection.cs
- XsdBuilder.cs
- ActivityTypeResolver.xaml.cs
- SafeCoTaskMem.cs
- _SSPISessionCache.cs
- RequestQueue.cs
- SimplePropertyEntry.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- ObfuscateAssemblyAttribute.cs
- XmlWrappingReader.cs
- SmtpNtlmAuthenticationModule.cs
- EntitySet.cs
- GenericAuthenticationEventArgs.cs
- SharedStatics.cs
- ScrollItemPattern.cs
- SqlConnection.cs
- ExpressionTextBox.xaml.cs
- DocumentPageTextView.cs
- LinkButton.cs
- Empty.cs
- SpecularMaterial.cs
- Int32RectValueSerializer.cs
- ValueTypeFixupInfo.cs
- shaperfactoryquerycacheentry.cs
- TextRunCache.cs
- BuildProvidersCompiler.cs
- UnmanagedHandle.cs
- BoundPropertyEntry.cs
- SetStoryboardSpeedRatio.cs
- DesignerTransaction.cs
- SemanticAnalyzer.cs
- DefinitionBase.cs
- BufferedMessageData.cs
- QueueProcessor.cs
- _UriTypeConverter.cs
- QilStrConcatenator.cs
- SessionChannels.cs
- SecurityTokenResolver.cs
- OdbcUtils.cs
- GenericsInstances.cs
- XamlLoadErrorInfo.cs
- UnicastIPAddressInformationCollection.cs
- EdmItemError.cs
- MouseOverProperty.cs
- ContractMapping.cs
- SqlBuffer.cs
- TraceHandlerErrorFormatter.cs
- WebPartUserCapability.cs
- SimpleWebHandlerParser.cs
- SpAudioStreamWrapper.cs
- PrintDocument.cs
- CalendarDay.cs
- MoveSizeWinEventHandler.cs
- AttributeProviderAttribute.cs
- DataGridViewCellConverter.cs