Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Configuration / TagMapCollection.cs / 1305376 / TagMapCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.IO; using System.Text; using System.Web.Util; using System.Web.UI; using System.Web.Compilation; using System.Threading; using System.Web.Configuration; using System.Security.Permissions; [ConfigurationCollection(typeof(TagMapInfo))] public sealed class TagMapCollection : ConfigurationElementCollection { private static ConfigurationPropertyCollection _properties; private Hashtable _tagMappings; static TagMapCollection() { // Property initialization _properties = new ConfigurationPropertyCollection(); } public TagMapCollection() { } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } public TagMapInfo this[int index] { get { return (TagMapInfo)BaseGet(index); } set { if (BaseGet(index) != null) { BaseRemoveAt(index); } BaseAdd(index, value); } } public void Add(TagMapInfo tagMapInformation) { BaseAdd(tagMapInformation); } public void Remove(TagMapInfo tagMapInformation) { BaseRemove(GetElementKey(tagMapInformation)); } public void Clear() { BaseClear(); } protected override ConfigurationElement CreateNewElement() { return new TagMapInfo(); } protected override Object GetElementKey(ConfigurationElement element) { return ((TagMapInfo)element).TagType; } internal Hashtable TagTypeMappingInternal { get { if (_tagMappings == null) { lock (this) { if (_tagMappings == null) { Hashtable tagMappings = new Hashtable(StringComparer.OrdinalIgnoreCase); foreach (TagMapInfo tmi in this) { Type tagType = ConfigUtil.GetType(tmi.TagType, "tagType", tmi); Type mappedTagType = ConfigUtil.GetType(tmi.MappedTagType, "mappedTagType", tmi); if (tagType.IsAssignableFrom(mappedTagType) == false) { throw new ConfigurationErrorsException( SR.GetString( SR.Mapped_type_must_inherit, tmi.MappedTagType, tmi.TagType), tmi.ElementInformation.Properties["mappedTagType"].Source, tmi.ElementInformation.Properties["mappedTagType"].LineNumber); } tagMappings[tagType] = mappedTagType; } _tagMappings = tagMappings; } } } return _tagMappings; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.IO; using System.Text; using System.Web.Util; using System.Web.UI; using System.Web.Compilation; using System.Threading; using System.Web.Configuration; using System.Security.Permissions; [ConfigurationCollection(typeof(TagMapInfo))] public sealed class TagMapCollection : ConfigurationElementCollection { private static ConfigurationPropertyCollection _properties; private Hashtable _tagMappings; static TagMapCollection() { // Property initialization _properties = new ConfigurationPropertyCollection(); } public TagMapCollection() { } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } public TagMapInfo this[int index] { get { return (TagMapInfo)BaseGet(index); } set { if (BaseGet(index) != null) { BaseRemoveAt(index); } BaseAdd(index, value); } } public void Add(TagMapInfo tagMapInformation) { BaseAdd(tagMapInformation); } public void Remove(TagMapInfo tagMapInformation) { BaseRemove(GetElementKey(tagMapInformation)); } public void Clear() { BaseClear(); } protected override ConfigurationElement CreateNewElement() { return new TagMapInfo(); } protected override Object GetElementKey(ConfigurationElement element) { return ((TagMapInfo)element).TagType; } internal Hashtable TagTypeMappingInternal { get { if (_tagMappings == null) { lock (this) { if (_tagMappings == null) { Hashtable tagMappings = new Hashtable(StringComparer.OrdinalIgnoreCase); foreach (TagMapInfo tmi in this) { Type tagType = ConfigUtil.GetType(tmi.TagType, "tagType", tmi); Type mappedTagType = ConfigUtil.GetType(tmi.MappedTagType, "mappedTagType", tmi); if (tagType.IsAssignableFrom(mappedTagType) == false) { throw new ConfigurationErrorsException( SR.GetString( SR.Mapped_type_must_inherit, tmi.MappedTagType, tmi.TagType), tmi.ElementInformation.Properties["mappedTagType"].Source, tmi.ElementInformation.Properties["mappedTagType"].LineNumber); } tagMappings[tagType] = mappedTagType; } _tagMappings = tagMappings; } } } return _tagMappings; } } } } // 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
- MessageQueueKey.cs
- VScrollBar.cs
- OleDbStruct.cs
- RayHitTestParameters.cs
- NamespaceInfo.cs
- DtrList.cs
- AttributeConverter.cs
- DataKey.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- MasterPage.cs
- RoleManagerEventArgs.cs
- IpcServerChannel.cs
- ClientProxyGenerator.cs
- TextTreeNode.cs
- ArgumentNullException.cs
- PriorityQueue.cs
- XPathAncestorQuery.cs
- OutputCacheEntry.cs
- DBDataPermission.cs
- ToolStripSplitStackLayout.cs
- ReadOnlyObservableCollection.cs
- WebPartEditorApplyVerb.cs
- CompilerTypeWithParams.cs
- filewebresponse.cs
- Adorner.cs
- ValueHandle.cs
- SamlAttribute.cs
- ObjectDataSourceDisposingEventArgs.cs
- TimerEventSubscription.cs
- ButtonFlatAdapter.cs
- ButtonChrome.cs
- CalendarAutoFormatDialog.cs
- BitmapFrameEncode.cs
- Automation.cs
- EventListenerClientSide.cs
- SpeechSeg.cs
- BaseComponentEditor.cs
- Policy.cs
- CaseExpr.cs
- BindingNavigatorDesigner.cs
- Utils.cs
- SizeChangedEventArgs.cs
- PathBox.cs
- HyperlinkAutomationPeer.cs
- TouchDevice.cs
- DragDropHelper.cs
- MasterPage.cs
- HandoffBehavior.cs
- WebBrowserSiteBase.cs
- DockEditor.cs
- StandardOleMarshalObject.cs
- TransformValueSerializer.cs
- TabControlCancelEvent.cs
- Int32RectValueSerializer.cs
- ColumnResizeAdorner.cs
- SmiRequestExecutor.cs
- Material.cs
- Vector3D.cs
- rsa.cs
- URL.cs
- ExpressionCopier.cs
- CodeConstructor.cs
- CompositeCollectionView.cs
- IIS7WorkerRequest.cs
- MetadataProperty.cs
- WebServiceResponse.cs
- EventDescriptor.cs
- MethodBody.cs
- Function.cs
- ConnectorRouter.cs
- ObjRef.cs
- ToolStripContainer.cs
- WebPartHeaderCloseVerb.cs
- PackagePart.cs
- FamilyMapCollection.cs
- PinnedBufferMemoryStream.cs
- ExtensibleClassFactory.cs
- DynamicHyperLink.cs
- ICspAsymmetricAlgorithm.cs
- WindowsComboBox.cs
- InOutArgumentConverter.cs
- WindowsEditBoxRange.cs
- BinaryNegotiation.cs
- WebConfigurationManager.cs
- AQNBuilder.cs
- SortFieldComparer.cs
- CultureInfoConverter.cs
- HandlerWithFactory.cs
- DataBindingHandlerAttribute.cs
- WindowsFormsSectionHandler.cs
- AppDomainProtocolHandler.cs
- VariableAction.cs
- SoapWriter.cs
- DelegatingTypeDescriptionProvider.cs
- xmlglyphRunInfo.cs
- FrameworkContentElementAutomationPeer.cs
- SmiRecordBuffer.cs
- ViewStateException.cs
- OptimizedTemplateContent.cs
- COM2EnumConverter.cs