Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Serialization / System / Runtime / Serialization / Configuration / DeclaredTypeElementCollection.cs / 1 / DeclaredTypeElementCollection.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Runtime.Serialization.Configuration { using System; using System.Configuration; using System.Globalization; [ConfigurationCollection(typeof(DeclaredTypeElement))] public sealed class DeclaredTypeElementCollection : ConfigurationElementCollection { public DeclaredTypeElementCollection() { } public DeclaredTypeElement this[int index] { get { DeclaredTypeElement retval = (DeclaredTypeElement)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 new DeclaredTypeElement this[string typeName] { get { if (String.IsNullOrEmpty(typeName)) { throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("typeName"); } DeclaredTypeElement retval = (DeclaredTypeElement)BaseGet(typeName); return retval; } set { // Only validate input if config is not Read-Only, otherwise // let Add throw appropriate exception if (!this.IsReadOnly()) { if (String.IsNullOrEmpty(typeName)) { throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("typeName"); } if (value == null) { throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value"); } if (BaseGet(typeName) != null) { BaseRemove(typeName); } else { throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new IndexOutOfRangeException(SR.GetString(SR.ConfigIndexOutOfRange, typeName))); } } Add(value); } } public void Add(DeclaredTypeElement 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 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() { DeclaredTypeElement retval = new DeclaredTypeElement(); return retval; } protected override Object GetElementKey(ConfigurationElement element) { if (element == null) { throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element"); } return ((DeclaredTypeElement)element).Type; } public int IndexOf(DeclaredTypeElement element) { if (element == null) { throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element"); } return BaseIndexOf(element); } public void Remove(DeclaredTypeElement 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 Remove(string typeName) { // Only validate input if config is not Read-Only, otherwise // let BaseRemove throw appropriate exception if (!this.IsReadOnly()) { if (String.IsNullOrEmpty(typeName)) { throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("typeName"); } } BaseRemove(typeName); } 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CodeSubDirectoriesCollection.cs
- M3DUtil.cs
- StorageModelBuildProvider.cs
- TabletCollection.cs
- RadioButtonList.cs
- TokenBasedSetEnumerator.cs
- SpecularMaterial.cs
- Classification.cs
- ScriptControlManager.cs
- ByteAnimation.cs
- Point3DKeyFrameCollection.cs
- XmlSchemaResource.cs
- PropertyGrid.cs
- QueryPageSettingsEventArgs.cs
- PtsPage.cs
- CachedBitmap.cs
- TextServicesPropertyRanges.cs
- DeclarativeExpressionConditionDeclaration.cs
- PointAnimation.cs
- XmlSchemaAttributeGroup.cs
- SequenceDesigner.cs
- DropShadowEffect.cs
- DSASignatureDeformatter.cs
- SimpleFieldTemplateFactory.cs
- CollectionViewProxy.cs
- ModifiableIteratorCollection.cs
- KnownTypeAttribute.cs
- IPAddressCollection.cs
- PingOptions.cs
- SerializationAttributes.cs
- PeerNearMe.cs
- TypeConverterAttribute.cs
- CompositeCollection.cs
- ToolboxItemCollection.cs
- EntitySqlException.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- HMACSHA256.cs
- FixedSOMTable.cs
- ButtonFlatAdapter.cs
- ContractTypeNameElement.cs
- PointCollectionConverter.cs
- NodeLabelEditEvent.cs
- XPathAxisIterator.cs
- AnnotationObservableCollection.cs
- VersionConverter.cs
- FilterEventArgs.cs
- SuppressIldasmAttribute.cs
- ErrorTolerantObjectWriter.cs
- HealthMonitoringSection.cs
- Part.cs
- BulletChrome.cs
- BuildManagerHost.cs
- ComponentSerializationService.cs
- OleDbSchemaGuid.cs
- Int32Rect.cs
- AggregatePushdown.cs
- PathFigureCollectionValueSerializer.cs
- StickyNote.cs
- SafeNativeMethodsOther.cs
- BitmapMetadataEnumerator.cs
- X509ScopedServiceCertificateElement.cs
- Oid.cs
- NameObjectCollectionBase.cs
- FileChangesMonitor.cs
- DesignTimeData.cs
- DesignerTransaction.cs
- PictureBox.cs
- SecurityListenerSettingsLifetimeManager.cs
- StringBuilder.cs
- Geometry3D.cs
- ArrayList.cs
- EncoderNLS.cs
- OutputCacheSettings.cs
- ExpressionStringBuilder.cs
- FixedSOMTable.cs
- CqlErrorHelper.cs
- AnchoredBlock.cs
- IisTraceListener.cs
- NonVisualControlAttribute.cs
- ManualWorkflowSchedulerService.cs
- Triplet.cs
- WebPartDescription.cs
- DataGridState.cs
- SqlPersonalizationProvider.cs
- XmlMtomReader.cs
- ObjectSpanRewriter.cs
- MouseButton.cs
- InkSerializer.cs
- UnsafeNativeMethods.cs
- ListBindingConverter.cs
- CompositeFontInfo.cs
- NumberSubstitution.cs
- Button.cs
- CompilationUtil.cs
- FixedSchema.cs
- FormatterServices.cs
- PerSessionInstanceContextProvider.cs
- StartFileNameEditor.cs
- SectionUpdates.cs
- TraceContext.cs