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
- PublisherMembershipCondition.cs
- sitestring.cs
- CustomCategoryAttribute.cs
- Rotation3DKeyFrameCollection.cs
- ResourceManagerWrapper.cs
- XmlTextReader.cs
- ContainerActivationHelper.cs
- MenuItemCollection.cs
- XmlILAnnotation.cs
- CultureSpecificStringDictionary.cs
- LockedBorderGlyph.cs
- DynamicDiscoveryDocument.cs
- DefinitionBase.cs
- ValidationPropertyAttribute.cs
- IPPacketInformation.cs
- TextTreePropertyUndoUnit.cs
- SecurityManager.cs
- ProviderUtil.cs
- XPathParser.cs
- MachineKeySection.cs
- GeneralTransform2DTo3D.cs
- EdmType.cs
- PackWebResponse.cs
- DependencyPropertyAttribute.cs
- ImageCollectionEditor.cs
- TreeChangeInfo.cs
- StringValueConverter.cs
- DataRowView.cs
- DispatcherTimer.cs
- AddInServer.cs
- MemoryFailPoint.cs
- glyphs.cs
- XmlNodeList.cs
- GradientStopCollection.cs
- Point4DConverter.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- ColorTranslator.cs
- UnitySerializationHolder.cs
- counter.cs
- VideoDrawing.cs
- AppDomainCompilerProxy.cs
- ApplyImportsAction.cs
- LinkArea.cs
- ProviderSettings.cs
- UndoEngine.cs
- UserPersonalizationStateInfo.cs
- Hashtable.cs
- _ChunkParse.cs
- SecurityKeyIdentifier.cs
- TransportSecurityProtocolFactory.cs
- UrlMappingsSection.cs
- WebHttpDispatchOperationSelector.cs
- Button.cs
- TransactionState.cs
- SQLMembershipProvider.cs
- HttpCachePolicy.cs
- SmuggledIUnknown.cs
- Int32CAMarshaler.cs
- DataBindingCollection.cs
- RightNameExpirationInfoPair.cs
- PeerNameRecord.cs
- OleDbCommand.cs
- CellConstant.cs
- OpenFileDialog.cs
- _TimerThread.cs
- ResXDataNode.cs
- NavigatingCancelEventArgs.cs
- figurelengthconverter.cs
- TextServicesContext.cs
- Translator.cs
- ChildrenQuery.cs
- EntityDataReader.cs
- Bezier.cs
- Int16Converter.cs
- MinimizableAttributeTypeConverter.cs
- SBCSCodePageEncoding.cs
- DataServiceRequestException.cs
- FormViewUpdateEventArgs.cs
- ActivityStatusChangeEventArgs.cs
- SplashScreen.cs
- SQLInt32.cs
- MemberExpression.cs
- XmlStreamNodeWriter.cs
- FontNamesConverter.cs
- ObjectDataSourceView.cs
- __FastResourceComparer.cs
- UpdateExpressionVisitor.cs
- XPathChildIterator.cs
- ClientSession.cs
- HashAlgorithm.cs
- ConditionalAttribute.cs
- LogExtentCollection.cs
- CodeGenerator.cs
- RoleManagerModule.cs
- ObjectStorage.cs
- ExportOptions.cs
- DictionaryContent.cs
- Module.cs
- RegexCompilationInfo.cs
- MinimizableAttributeTypeConverter.cs