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
- XdrBuilder.cs
- ObjectDataSourceFilteringEventArgs.cs
- HitTestWithPointDrawingContextWalker.cs
- dataprotectionpermissionattribute.cs
- CfgParser.cs
- WindowsToolbar.cs
- PropertyItemInternal.cs
- SecurityTokenTypes.cs
- WebColorConverter.cs
- MeasurementDCInfo.cs
- HostSecurityManager.cs
- DataGridPagerStyle.cs
- LinkedList.cs
- ClientTargetCollection.cs
- EntityDataSourceDataSelection.cs
- ScriptManager.cs
- ComplexBindingPropertiesAttribute.cs
- WebPartManager.cs
- PeerToPeerException.cs
- _HeaderInfoTable.cs
- ExpressionBindingsDialog.cs
- OracleLob.cs
- ManifestSignedXml.cs
- Membership.cs
- CreateUserWizard.cs
- PropertyOrder.cs
- TrustLevelCollection.cs
- AcceleratedTokenProvider.cs
- ImageMapEventArgs.cs
- RichTextBoxConstants.cs
- DispatcherEventArgs.cs
- TraceXPathNavigator.cs
- InputBinding.cs
- DynamicValidator.cs
- DbRetry.cs
- DataGridViewCellStyleChangedEventArgs.cs
- ProfileService.cs
- XsltFunctions.cs
- PathSegment.cs
- TableLayoutSettingsTypeConverter.cs
- ToolBar.cs
- ContentFilePart.cs
- TypeDelegator.cs
- Property.cs
- EntityConnectionStringBuilderItem.cs
- PointCollectionConverter.cs
- TemplatedAdorner.cs
- Persist.cs
- SecurityContext.cs
- CompensationToken.cs
- GraphicsState.cs
- FontDriver.cs
- DateTimeFormatInfoScanner.cs
- FixedStringLookup.cs
- Base64Decoder.cs
- DataSourceListEditor.cs
- MULTI_QI.cs
- XsltArgumentList.cs
- XsltInput.cs
- NamedPipeConnectionPoolSettingsElement.cs
- BufferedGraphicsManager.cs
- DragCompletedEventArgs.cs
- FontEmbeddingManager.cs
- MachineKeyConverter.cs
- RepeaterCommandEventArgs.cs
- CounterCreationDataCollection.cs
- ViewManager.cs
- NullableIntAverageAggregationOperator.cs
- SharedDp.cs
- PathTooLongException.cs
- ButtonField.cs
- RecognizerStateChangedEventArgs.cs
- View.cs
- SessionPageStatePersister.cs
- FontConverter.cs
- ToolStripItemRenderEventArgs.cs
- TypeNameConverter.cs
- FileDataSourceCache.cs
- SystemInfo.cs
- DoubleLink.cs
- LogEntryHeaderSerializer.cs
- XmlWriterTraceListener.cs
- Camera.cs
- Point3DCollection.cs
- DataControlFieldHeaderCell.cs
- ObjectCloneHelper.cs
- AnimationLayer.cs
- EntityWithKeyStrategy.cs
- TextEndOfSegment.cs
- SystemWebCachingSectionGroup.cs
- XPathPatternBuilder.cs
- DataGridDesigner.cs
- OdbcConnectionStringbuilder.cs
- SqlDataSourceCommandEventArgs.cs
- EnumerableCollectionView.cs
- SchemaSetCompiler.cs
- DbConnectionStringCommon.cs
- PartialTrustVisibleAssembly.cs
- SqlUdtInfo.cs
- StackBuilderSink.cs