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
- ZipIOFileItemStream.cs
- OracleInternalConnection.cs
- ScopeElement.cs
- AdPostCacheSubstitution.cs
- SQLInt32.cs
- CompositeFontFamily.cs
- StorageConditionPropertyMapping.cs
- storepermission.cs
- figurelengthconverter.cs
- mactripleDES.cs
- WSSecurityXXX2005.cs
- ListBoxItem.cs
- DataObject.cs
- XPathNode.cs
- TextRange.cs
- DataGridViewCellStyleConverter.cs
- TreeNodeCollection.cs
- HitTestParameters3D.cs
- XhtmlTextWriter.cs
- XPathCompileException.cs
- RadioButton.cs
- MasterPageBuildProvider.cs
- MissingMemberException.cs
- PrivacyNoticeElement.cs
- transactioncontext.cs
- ResolveMatchesMessage11.cs
- AttributeCollection.cs
- HttpRawResponse.cs
- FormatConvertedBitmap.cs
- MimeTypeMapper.cs
- XmlEnumAttribute.cs
- CombinedGeometry.cs
- GlyphShapingProperties.cs
- DataViewSetting.cs
- AnimationException.cs
- EventTrigger.cs
- AddInAdapter.cs
- SqlUnionizer.cs
- TextDecorationCollection.cs
- DiscoveryRequestHandler.cs
- ObjectStorage.cs
- DbConnectionClosed.cs
- PartialClassGenerationTask.cs
- OperatingSystem.cs
- StorageInfo.cs
- RadialGradientBrush.cs
- KeyboardEventArgs.cs
- OpenFileDialog.cs
- Oci.cs
- ILGenerator.cs
- ToolStripControlHost.cs
- DuplicateDetector.cs
- ComboBoxItem.cs
- NameSpaceExtractor.cs
- XPathExpr.cs
- PublisherIdentityPermission.cs
- StrokeRenderer.cs
- TextEditorTables.cs
- ImageSource.cs
- ValidationPropertyAttribute.cs
- SmtpFailedRecipientsException.cs
- SizeF.cs
- Page.cs
- ImagingCache.cs
- Activity.cs
- SystemResourceHost.cs
- TextInfo.cs
- QilReference.cs
- XmlWellformedWriter.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- Compilation.cs
- xmlglyphRunInfo.cs
- EncoderReplacementFallback.cs
- ErrorWebPart.cs
- _ProxyRegBlob.cs
- XmlIlVisitor.cs
- ToolStripCollectionEditor.cs
- MILUtilities.cs
- SoapReflectionImporter.cs
- TextEffectResolver.cs
- BufferedWebEventProvider.cs
- ComContractElementCollection.cs
- DataSourceControlBuilder.cs
- AnchorEditor.cs
- ListViewGroupConverter.cs
- x509utils.cs
- EventDriven.cs
- AuthenticateEventArgs.cs
- OdbcParameterCollection.cs
- DbConnectionPool.cs
- ProviderUtil.cs
- Profiler.cs
- BaseValidatorDesigner.cs
- Separator.cs
- PrincipalPermission.cs
- DataControlReference.cs
- HttpWebRequestElement.cs
- FormsAuthenticationCredentials.cs
- TrackBarRenderer.cs
- CollectionViewGroupRoot.cs