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
- SQLCharsStorage.cs
- PackageDigitalSignature.cs
- TextElementEnumerator.cs
- TreeNodeStyleCollection.cs
- ExtensionDataObject.cs
- ProxyAttribute.cs
- DataGridViewRowPostPaintEventArgs.cs
- _SslStream.cs
- XmlSchemaDatatype.cs
- DataBinding.cs
- SrgsDocumentParser.cs
- ComponentConverter.cs
- FontFamilyIdentifier.cs
- TextServicesCompartmentContext.cs
- Timer.cs
- StyleCollectionEditor.cs
- DatagridviewDisplayedBandsData.cs
- CFStream.cs
- BinaryObjectInfo.cs
- Geometry.cs
- PartialCachingAttribute.cs
- XamlFigureLengthSerializer.cs
- Baml6Assembly.cs
- DesignerActionPanel.cs
- FontInfo.cs
- InternalDispatchObject.cs
- SmiConnection.cs
- TypeNameConverter.cs
- DataObjectMethodAttribute.cs
- IntSecurity.cs
- OperationContext.cs
- TerminatorSinks.cs
- DataGridLinkButton.cs
- RowTypePropertyElement.cs
- SqlTypeSystemProvider.cs
- DataMember.cs
- SignedPkcs7.cs
- ToolBar.cs
- EntryWrittenEventArgs.cs
- DmlSqlGenerator.cs
- ListViewItem.cs
- InnerItemCollectionView.cs
- WorkflowWebHostingModule.cs
- ImportContext.cs
- HttpCacheParams.cs
- XamlToRtfWriter.cs
- Attribute.cs
- XmlAttribute.cs
- UIElement.cs
- ColumnMapTranslator.cs
- Clock.cs
- EditorZone.cs
- TreeViewEvent.cs
- ErrorsHelper.cs
- Ref.cs
- WrappedKeySecurityToken.cs
- QueryStatement.cs
- ListViewItemSelectionChangedEvent.cs
- CryptoHelper.cs
- DynamicResourceExtensionConverter.cs
- ConfigUtil.cs
- TdsParserHelperClasses.cs
- DataGridCellsPanel.cs
- IdentityReference.cs
- _TimerThread.cs
- ApplicationInfo.cs
- SynchronizedChannelCollection.cs
- InlineCollection.cs
- SHA1.cs
- _PooledStream.cs
- TextEndOfSegment.cs
- DataObjectCopyingEventArgs.cs
- LogEntrySerializationException.cs
- ClosableStream.cs
- SessionIDManager.cs
- Calendar.cs
- AssemblyBuilder.cs
- InitializationEventAttribute.cs
- ValidationRule.cs
- AttachInfo.cs
- LocalValueEnumerator.cs
- ProjectionAnalyzer.cs
- MetadataProperty.cs
- DataGridViewCellCollection.cs
- KnownBoxes.cs
- DataGridRowHeaderAutomationPeer.cs
- NumberFunctions.cs
- AnnotationDocumentPaginator.cs
- DirtyTextRange.cs
- InfiniteIntConverter.cs
- BrowserTree.cs
- HttpInputStream.cs
- LinkArea.cs
- unitconverter.cs
- PopupRootAutomationPeer.cs
- Stacktrace.cs
- Int16AnimationUsingKeyFrames.cs
- HttpCacheVary.cs
- EntitySetDataBindingList.cs
- ExceptionHandlerDesigner.cs