Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Serialization / System / Runtime / Serialization / Configuration / TypeElementCollection.cs / 1 / TypeElementCollection.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Runtime.Serialization.Configuration { using System; using System.Configuration; using System.Globalization; [ConfigurationCollection(typeof(TypeElement), CollectionType = ConfigurationElementCollectionType.BasicMap)] public sealed class TypeElementCollection : ConfigurationElementCollection { public TypeElementCollection() { } public TypeElement this[int index] { get { TypeElement retval = (TypeElement)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(TypeElement 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; } } protected override ConfigurationElement CreateNewElement() { TypeElement retval = new TypeElement(); return retval; } protected override string ElementName { get { return TypeElementCollection.KnownTypeConfig; } } protected override Object GetElementKey(ConfigurationElement element) { if (element == null) { throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element"); } return ((TypeElement)element).Key; } public int IndexOf(TypeElement element) { if (element == null) { throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element"); } return BaseIndexOf(element); } public void Remove(TypeElement 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); } const string KnownTypeConfig = "knownType"; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HttpListenerElement.cs
- RecommendedAsConfigurableAttribute.cs
- ComponentCache.cs
- ProvidersHelper.cs
- RuntimeConfig.cs
- SimpleTypeResolver.cs
- ProcessHostFactoryHelper.cs
- NamespaceQuery.cs
- InfoCardClaim.cs
- Repeater.cs
- GlyphInfoList.cs
- Cursor.cs
- EntityDesignPluralizationHandler.cs
- Opcode.cs
- MailHeaderInfo.cs
- DetailsViewDeletedEventArgs.cs
- TCPClient.cs
- ProviderConnectionPointCollection.cs
- ImageKeyConverter.cs
- DependencyPropertyConverter.cs
- TransformerTypeCollection.cs
- KeyEventArgs.cs
- StatusBarAutomationPeer.cs
- Application.cs
- WsdlEndpointConversionContext.cs
- ClientTarget.cs
- ErrorProvider.cs
- DBAsyncResult.cs
- WeakReferenceList.cs
- MessageBox.cs
- RemoteCryptoRsaServiceProvider.cs
- ObjectViewQueryResultData.cs
- ArcSegment.cs
- DateTime.cs
- Camera.cs
- DbCommandTree.cs
- SqlClientFactory.cs
- _DisconnectOverlappedAsyncResult.cs
- FrameworkTemplate.cs
- TimelineGroup.cs
- VariableQuery.cs
- ActivityDesignerHelper.cs
- DocumentApplication.cs
- EntityModelSchemaGenerator.cs
- TransformDescriptor.cs
- ClientSponsor.cs
- OleDbRowUpdatingEvent.cs
- EntityDataSourceState.cs
- UnionExpr.cs
- LocalizableResourceBuilder.cs
- DnsPermission.cs
- NoResizeSelectionBorderGlyph.cs
- XslAst.cs
- EllipticalNodeOperations.cs
- SubstitutionResponseElement.cs
- Random.cs
- XmlTextReader.cs
- Image.cs
- HelpEvent.cs
- SyndicationFeedFormatter.cs
- CustomErrorsSectionWrapper.cs
- DataGridViewAccessibleObject.cs
- SafeArrayTypeMismatchException.cs
- Icon.cs
- PageRouteHandler.cs
- IpcManager.cs
- DataGridLinkButton.cs
- TypeDescriptionProviderAttribute.cs
- CriticalHandle.cs
- ObjectSet.cs
- DesignObjectWrapper.cs
- WorkerRequest.cs
- HttpConfigurationSystem.cs
- ProfilePropertySettings.cs
- DataBoundControlAdapter.cs
- EncodingInfo.cs
- SqlTrackingQuery.cs
- DataTable.cs
- StylusEventArgs.cs
- DataComponentGenerator.cs
- HttpCacheVary.cs
- ProfilePropertyNameValidator.cs
- MethodRental.cs
- SqlDuplicator.cs
- DoubleIndependentAnimationStorage.cs
- IOThreadScheduler.cs
- PageBreakRecord.cs
- Stack.cs
- SolidBrush.cs
- AbstractExpressions.cs
- LoginViewDesigner.cs
- GroupStyle.cs
- _Semaphore.cs
- SerializerDescriptor.cs
- SQLConvert.cs
- WebAdminConfigurationHelper.cs
- ConnectionPoint.cs
- NavigationProperty.cs
- PointLightBase.cs
- DesignerAttributeInfo.cs