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
- ColumnCollectionEditor.cs
- Rule.cs
- TextServicesCompartment.cs
- Variant.cs
- SqlReorderer.cs
- TableLayout.cs
- VisualCollection.cs
- BehaviorEditorPart.cs
- KeyboardInputProviderAcquireFocusEventArgs.cs
- SubordinateTransaction.cs
- WebPartConnectionsEventArgs.cs
- X509CertificateRecipientClientCredential.cs
- QilInvokeLateBound.cs
- CharacterMetrics.cs
- DbDataRecord.cs
- TransformedBitmap.cs
- DoWhileDesigner.xaml.cs
- DomainLiteralReader.cs
- Viewport3DAutomationPeer.cs
- StreamProxy.cs
- DataControlCommands.cs
- HelpEvent.cs
- SrgsRuleRef.cs
- XmlArrayItemAttributes.cs
- SqlProcedureAttribute.cs
- QuotedPrintableStream.cs
- ExpressionNode.cs
- CopyCodeAction.cs
- MetadataSerializer.cs
- SystemDiagnosticsSection.cs
- DataControlField.cs
- VariableBinder.cs
- CodePageUtils.cs
- DesignerTransactionCloseEvent.cs
- FixedSOMImage.cs
- UInt64.cs
- IdentitySection.cs
- StateChangeEvent.cs
- PropertyEntry.cs
- ResourceAttributes.cs
- NetSectionGroup.cs
- PropertyTabAttribute.cs
- XsdDuration.cs
- FixedSOMTableCell.cs
- ReadingWritingEntityEventArgs.cs
- Stacktrace.cs
- LayoutEngine.cs
- SqlStatistics.cs
- SafeFileMappingHandle.cs
- TextAutomationPeer.cs
- CodeTypeReferenceCollection.cs
- GatewayDefinition.cs
- ReferencedType.cs
- ToolboxBitmapAttribute.cs
- ExtendedProperty.cs
- DrawingVisual.cs
- WebDescriptionAttribute.cs
- PriorityQueue.cs
- ControlPager.cs
- EmptyEnumerator.cs
- SharedConnectionListener.cs
- Deflater.cs
- ReaderOutput.cs
- _HeaderInfo.cs
- PropertyDescriptorGridEntry.cs
- FixedTextContainer.cs
- listitem.cs
- BitmapSizeOptions.cs
- BevelBitmapEffect.cs
- IsolationInterop.cs
- WsatConfiguration.cs
- VisualStyleInformation.cs
- BitmapCodecInfo.cs
- SoapElementAttribute.cs
- EditorServiceContext.cs
- Annotation.cs
- BaseCodeDomTreeGenerator.cs
- ServiceContractListItemList.cs
- RenderingBiasValidation.cs
- ModelItem.cs
- TableParaClient.cs
- WebBrowserHelper.cs
- TextParentUndoUnit.cs
- QilUnary.cs
- LateBoundBitmapDecoder.cs
- FixedSOMPageConstructor.cs
- ThreadSafeList.cs
- EndpointDiscoveryBehavior.cs
- RequestCachePolicy.cs
- ScriptManagerProxy.cs
- SerializerDescriptor.cs
- XmlQueryStaticData.cs
- FixedSOMElement.cs
- XmlILCommand.cs
- TextTreeRootTextBlock.cs
- TypedDatasetGenerator.cs
- DiscoveryOperationContext.cs
- ErrorProvider.cs
- SettingsSection.cs
- HMACMD5.cs