Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / xsp / System / Web / Extensions / Configuration / ConvertersCollection.cs / 2 / ConvertersCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Collections.Generic; using System.Configuration; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Security.Permissions; using System.Web; using System.Web.Compilation; using System.Web.Resources; using System.Web.Script.Serialization; [ AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal), ConfigurationCollection(typeof(Converter)), SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface", Justification="Derives from legacy collection base class. Base method IsReadOnly() " + "would clash with property ICollection.IsReadOnly.") ] public class ConvertersCollection : ConfigurationElementCollection { private static readonly ConfigurationPropertyCollection _properties = new ConfigurationPropertyCollection(); public ConvertersCollection() { } [SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")] protected override ConfigurationPropertyCollection Properties { get { return _properties; } } public Converter this[int index] { get { return (Converter)BaseGet(index); } set { if (BaseGet(index) != null) { BaseRemoveAt(index); } BaseAdd(index, value); } } public void Add(Converter converter) { BaseAdd(converter); } public void Remove(Converter converter) { BaseRemove(GetElementKey(converter)); } public void Clear() { BaseClear(); } [SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")] protected override ConfigurationElement CreateNewElement() { return new Converter(); } [SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")] protected override Object GetElementKey(ConfigurationElement element) { return ((Converter)element).Name; } internal JavaScriptConverter[] CreateConverters() { List list = new List (); foreach (Converter converter in this) { Type t = BuildManager.GetType(converter.Type, false /*throwOnError*/); if (t == null) { throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, AtlasWeb.ConvertersCollection_UnknownType, converter.Type)); } if (!typeof(JavaScriptConverter).IsAssignableFrom(t)) { throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, AtlasWeb.ConvertersCollection_NotJavaScriptConverter, t.Name)); } list.Add((JavaScriptConverter)Activator.CreateInstance(t)); } return list.ToArray(); } } } // 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.Collections.Generic; using System.Configuration; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Security.Permissions; using System.Web; using System.Web.Compilation; using System.Web.Resources; using System.Web.Script.Serialization; [ AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal), ConfigurationCollection(typeof(Converter)), SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface", Justification="Derives from legacy collection base class. Base method IsReadOnly() " + "would clash with property ICollection.IsReadOnly.") ] public class ConvertersCollection : ConfigurationElementCollection { private static readonly ConfigurationPropertyCollection _properties = new ConfigurationPropertyCollection(); public ConvertersCollection() { } [SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")] protected override ConfigurationPropertyCollection Properties { get { return _properties; } } public Converter this[int index] { get { return (Converter)BaseGet(index); } set { if (BaseGet(index) != null) { BaseRemoveAt(index); } BaseAdd(index, value); } } public void Add(Converter converter) { BaseAdd(converter); } public void Remove(Converter converter) { BaseRemove(GetElementKey(converter)); } public void Clear() { BaseClear(); } [SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")] protected override ConfigurationElement CreateNewElement() { return new Converter(); } [SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")] protected override Object GetElementKey(ConfigurationElement element) { return ((Converter)element).Name; } internal JavaScriptConverter[] CreateConverters() { List list = new List (); foreach (Converter converter in this) { Type t = BuildManager.GetType(converter.Type, false /*throwOnError*/); if (t == null) { throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, AtlasWeb.ConvertersCollection_UnknownType, converter.Type)); } if (!typeof(JavaScriptConverter).IsAssignableFrom(t)) { throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, AtlasWeb.ConvertersCollection_NotJavaScriptConverter, t.Name)); } list.Add((JavaScriptConverter)Activator.CreateInstance(t)); } return list.ToArray(); } } } // 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
- VarInfo.cs
- ToolStripItemEventArgs.cs
- WriteTimeStream.cs
- AdjustableArrowCap.cs
- XmlAttributes.cs
- XsltContext.cs
- X509Certificate.cs
- TextEndOfSegment.cs
- Int64Storage.cs
- DataGridViewRowPostPaintEventArgs.cs
- CrossAppDomainChannel.cs
- DiscoveryMessageSequenceGenerator.cs
- ImageFormatConverter.cs
- EqualityArray.cs
- TableChangeProcessor.cs
- DataIdProcessor.cs
- _LocalDataStore.cs
- ProtocolsConfiguration.cs
- ControlBuilderAttribute.cs
- InArgument.cs
- BezierSegment.cs
- wmiprovider.cs
- HttpCookie.cs
- MemoryStream.cs
- objectresult_tresulttype.cs
- DriveInfo.cs
- PrivacyNoticeElement.cs
- AdRotator.cs
- RewritingPass.cs
- DeviceFilterDictionary.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- StreamGeometry.cs
- GlobalEventManager.cs
- WindowsRichEdit.cs
- DesignerAutoFormatStyle.cs
- TreeIterators.cs
- PresentationAppDomainManager.cs
- SqlTypesSchemaImporter.cs
- CharacterHit.cs
- VisualStyleTypesAndProperties.cs
- fixedPageContentExtractor.cs
- RuleSettingsCollection.cs
- DataMemberAttribute.cs
- ParentQuery.cs
- PromptBuilder.cs
- MetadataItem_Static.cs
- CompilerScopeManager.cs
- SamlAuthenticationStatement.cs
- ActivityLocationReferenceEnvironment.cs
- ItemContainerGenerator.cs
- COM2Enum.cs
- InheritanceAttribute.cs
- TraceRecords.cs
- AdornerPresentationContext.cs
- Metafile.cs
- SafeRegistryHandle.cs
- LazyTextWriterCreator.cs
- XpsSerializationManager.cs
- ProfileGroupSettingsCollection.cs
- DataTemplateKey.cs
- ConfigurationStrings.cs
- WebPartPersonalization.cs
- QfeChecker.cs
- GridSplitter.cs
- ModuleBuilder.cs
- SiteMapNodeItem.cs
- PageStatePersister.cs
- Helpers.cs
- GridViewPageEventArgs.cs
- RemoveStoryboard.cs
- counter.cs
- IImplicitResourceProvider.cs
- ListViewTableCell.cs
- CapabilitiesState.cs
- connectionpool.cs
- Byte.cs
- Deserializer.cs
- SqlPersonalizationProvider.cs
- PriorityItem.cs
- Clause.cs
- COM2PropertyDescriptor.cs
- ThreadNeutralSemaphore.cs
- TypedDataSourceCodeGenerator.cs
- SqlError.cs
- LifetimeServices.cs
- MonitorWrapper.cs
- ModifyActivitiesPropertyDescriptor.cs
- PropertyManager.cs
- PopupRootAutomationPeer.cs
- PointLight.cs
- DateTimeSerializationSection.cs
- KeyBinding.cs
- UnsafeNativeMethods.cs
- httpserverutility.cs
- DesignerPerfEventProvider.cs
- SelectionList.cs
- dbdatarecord.cs
- XsltOutput.cs
- TraceData.cs
- VectorConverter.cs