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
- codemethodreferenceexpression.cs
- OutputCacheSettings.cs
- PerfService.cs
- VectorCollectionValueSerializer.cs
- Logging.cs
- AccessibleObject.cs
- AuthorizationContext.cs
- SqlIdentifier.cs
- DbProviderSpecificTypePropertyAttribute.cs
- SessionParameter.cs
- TableStyle.cs
- VScrollProperties.cs
- LinqDataSourceStatusEventArgs.cs
- ExtensionSimplifierMarkupObject.cs
- NonSerializedAttribute.cs
- ParentQuery.cs
- CookieParameter.cs
- HostedTransportConfigurationManager.cs
- ListDictionary.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- HeaderPanel.cs
- DbDataRecord.cs
- NestPullup.cs
- PostBackTrigger.cs
- ColorConverter.cs
- DataService.cs
- SqlTypeConverter.cs
- CryptographicAttribute.cs
- WizardForm.cs
- CompilerScopeManager.cs
- TypeDelegator.cs
- CryptoKeySecurity.cs
- WindowsRebar.cs
- ElementMarkupObject.cs
- COM2PropertyPageUITypeConverter.cs
- OleDbDataAdapter.cs
- DataGridCommandEventArgs.cs
- OleDbConnection.cs
- XmlDataCollection.cs
- SqlCacheDependency.cs
- DecimalStorage.cs
- XmlSchemaSimpleContent.cs
- QuaternionAnimation.cs
- WebException.cs
- SchemaNotation.cs
- StylusDownEventArgs.cs
- GroupLabel.cs
- Action.cs
- ListBoxItemWrapperAutomationPeer.cs
- FlatButtonAppearance.cs
- ReadWriteSpinLock.cs
- PrtCap_Public_Simple.cs
- NavigationCommands.cs
- AssemblyInfo.cs
- MethodImplAttribute.cs
- RegexCompiler.cs
- ScriptReferenceEventArgs.cs
- EntityException.cs
- IfAction.cs
- WindowsGraphicsWrapper.cs
- ExeConfigurationFileMap.cs
- DataControlFieldCell.cs
- Operator.cs
- MessageBox.cs
- TraceLog.cs
- DataGridToolTip.cs
- DbConnectionStringBuilder.cs
- OperationBehaviorAttribute.cs
- MatchingStyle.cs
- XmlDeclaration.cs
- CookielessHelper.cs
- XmlILTrace.cs
- SessionStateSection.cs
- fixedPageContentExtractor.cs
- BitmapMetadataBlob.cs
- PermissionAttributes.cs
- SoapProtocolReflector.cs
- _Semaphore.cs
- TreeView.cs
- DataGridAutoFormat.cs
- ViewStateModeByIdAttribute.cs
- shaper.cs
- PolicyException.cs
- Parsers.cs
- BuilderInfo.cs
- SiteMap.cs
- DataIdProcessor.cs
- PropertyIdentifier.cs
- XslTransform.cs
- ButtonBase.cs
- HashSet.cs
- SoapTransportImporter.cs
- CodeTypeDelegate.cs
- Documentation.cs
- FormattedText.cs
- ImageListStreamer.cs
- DateTimeOffsetStorage.cs
- TypeDependencyAttribute.cs
- CommandHelper.cs
- DesigntimeLicenseContext.cs