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
- RichTextBoxAutomationPeer.cs
- CapabilitiesSection.cs
- RawKeyboardInputReport.cs
- Simplifier.cs
- OleDbDataReader.cs
- TagPrefixCollection.cs
- NotifyIcon.cs
- DynamicValidatorEventArgs.cs
- sitestring.cs
- DataGrid.cs
- ControlType.cs
- SystemIPv6InterfaceProperties.cs
- UIElementCollection.cs
- TargetControlTypeCache.cs
- EpmTargetPathSegment.cs
- DefaultMemberAttribute.cs
- DependencyPropertyChangedEventArgs.cs
- PropertyChangedEventManager.cs
- GAC.cs
- StandardBindingCollectionElement.cs
- COM2ComponentEditor.cs
- EntityCommandCompilationException.cs
- DataGridViewTextBoxColumn.cs
- KeyEvent.cs
- DocumentPageTextView.cs
- TypeConverterAttribute.cs
- UIElement.cs
- WebAdminConfigurationHelper.cs
- WebPartMenu.cs
- FormViewInsertedEventArgs.cs
- DefaultSerializationProviderAttribute.cs
- Filter.cs
- SqlDataSourceSelectingEventArgs.cs
- TypedElement.cs
- VirtualDirectoryMappingCollection.cs
- Privilege.cs
- RouteValueDictionary.cs
- ExtenderProvidedPropertyAttribute.cs
- DesignUtil.cs
- LinkAreaEditor.cs
- XmlSchemaFacet.cs
- TextWriterTraceListener.cs
- PageThemeCodeDomTreeGenerator.cs
- XmlChildNodes.cs
- ConditionCollection.cs
- MemberAccessException.cs
- ScrollProviderWrapper.cs
- CmsInterop.cs
- AnnotationService.cs
- SQLRoleProvider.cs
- FormatterServicesNoSerializableCheck.cs
- VisualTreeUtils.cs
- DBNull.cs
- AnnotationResourceCollection.cs
- ButtonColumn.cs
- RSAProtectedConfigurationProvider.cs
- WebContentFormatHelper.cs
- TemplateContentLoader.cs
- QueryMath.cs
- HashCodeCombiner.cs
- SqlConnectionPoolProviderInfo.cs
- UrlAuthFailedErrorFormatter.cs
- TextRange.cs
- UnauthorizedAccessException.cs
- ResXDataNode.cs
- Soap.cs
- RemoveStoryboard.cs
- SQLByteStorage.cs
- HttpCacheVary.cs
- SHA384Managed.cs
- SharedUtils.cs
- Compensate.cs
- InvokePatternIdentifiers.cs
- WebPartCatalogAddVerb.cs
- DesignerForm.cs
- NameObjectCollectionBase.cs
- DependencyPropertyChangedEventArgs.cs
- AbstractExpressions.cs
- SafeRegistryHandle.cs
- MultiSelector.cs
- XmlSchemaSimpleContentRestriction.cs
- GlobalEventManager.cs
- TextEditorTables.cs
- JsonXmlDataContract.cs
- CollectionsUtil.cs
- WsdlHelpGeneratorElement.cs
- EmptyElement.cs
- DataErrorValidationRule.cs
- TextEffect.cs
- GPPOINTF.cs
- LabelLiteral.cs
- ConfigurationPermission.cs
- NonPrimarySelectionGlyph.cs
- DataKey.cs
- CodeCompiler.cs
- OperatorExpressions.cs
- EdmComplexPropertyAttribute.cs
- unsafenativemethodstextservices.cs
- ConstructorBuilder.cs
- TextSelectionHighlightLayer.cs