Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / xsp / System / Web / Extensions / Configuration / ConvertersCollection.cs / 1 / 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
- NCryptSafeHandles.cs
- WebBaseEventKeyComparer.cs
- BindingGroup.cs
- Brush.cs
- XmlSchemaAnnotated.cs
- TdsParserStaticMethods.cs
- Point.cs
- SystemUnicastIPAddressInformation.cs
- CultureData.cs
- EditBehavior.cs
- TextEditorCopyPaste.cs
- Pen.cs
- AutomationPropertyInfo.cs
- ChtmlLinkAdapter.cs
- ProfileSettings.cs
- PersonalizableAttribute.cs
- ObjectDataSourceStatusEventArgs.cs
- AssemblyInfo.cs
- UserNamePasswordValidationMode.cs
- Int16AnimationUsingKeyFrames.cs
- AtomContentProperty.cs
- SByteStorage.cs
- StandardOleMarshalObject.cs
- ConfigXmlAttribute.cs
- DocumentAutomationPeer.cs
- FrameworkElementFactoryMarkupObject.cs
- FieldBuilder.cs
- Variant.cs
- Binding.cs
- XmlSchemaAnnotated.cs
- ToolstripProfessionalRenderer.cs
- GeometryValueSerializer.cs
- IResourceProvider.cs
- ServiceHandle.cs
- DbConnectionPoolOptions.cs
- KeyInterop.cs
- TextSelection.cs
- ComponentManagerBroker.cs
- EntityParameter.cs
- HtmlToClrEventProxy.cs
- XPathDescendantIterator.cs
- PKCS1MaskGenerationMethod.cs
- GC.cs
- MD5.cs
- FixedElement.cs
- Stream.cs
- IdentityNotMappedException.cs
- _HelperAsyncResults.cs
- SerializationException.cs
- _LocalDataStoreMgr.cs
- ComboBox.cs
- SystemTcpConnection.cs
- Preprocessor.cs
- IsolatedStorageFilePermission.cs
- XmlIlGenerator.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- HttpWriter.cs
- ProfilePropertyNameValidator.cs
- precedingsibling.cs
- New.cs
- KeyPullup.cs
- OptionalColumn.cs
- CleanUpVirtualizedItemEventArgs.cs
- AutomationPatternInfo.cs
- EventProvider.cs
- MarkupExtensionParser.cs
- OleDbWrapper.cs
- SchemaCollectionCompiler.cs
- OptimisticConcurrencyException.cs
- xmlfixedPageInfo.cs
- Executor.cs
- RoleManagerEventArgs.cs
- BackEase.cs
- DataGridViewTopLeftHeaderCell.cs
- StorageBasedPackageProperties.cs
- DashStyle.cs
- DragDrop.cs
- ListBase.cs
- GridProviderWrapper.cs
- PrimitiveXmlSerializers.cs
- LinearGradientBrush.cs
- DataContractSerializerSection.cs
- CommunicationException.cs
- InkSerializer.cs
- TabControlEvent.cs
- DataSourceXmlSerializer.cs
- Annotation.cs
- ProfileProvider.cs
- NetworkInformationException.cs
- DataObjectEventArgs.cs
- DataGridViewCellMouseEventArgs.cs
- RelationshipSet.cs
- SqlDataSourceConfigureSelectPanel.cs
- InputBinder.cs
- SqlGenericUtil.cs
- WeakEventTable.cs
- CharacterBuffer.cs
- validationstate.cs
- storepermission.cs
- RepeaterItemEventArgs.cs