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
- KeyedHashAlgorithm.cs
- EntryWrittenEventArgs.cs
- GetPageCompletedEventArgs.cs
- XmlSchemaAnnotated.cs
- FindResponse.cs
- DispatcherFrame.cs
- Int64Converter.cs
- NameGenerator.cs
- EncryptedData.cs
- __FastResourceComparer.cs
- DataGridCommandEventArgs.cs
- UInt16Converter.cs
- EncodingInfo.cs
- AutomationPropertyInfo.cs
- CapabilitiesPattern.cs
- Style.cs
- Query.cs
- GridItem.cs
- NullableDoubleMinMaxAggregationOperator.cs
- AssemblyUtil.cs
- ImageSource.cs
- TimerElapsedEvenArgs.cs
- SourceElementsCollection.cs
- SrgsElementFactoryCompiler.cs
- BitmapFrame.cs
- SecurityTokenAttachmentMode.cs
- IsolatedStoragePermission.cs
- wpf-etw.cs
- GcSettings.cs
- MD5CryptoServiceProvider.cs
- updatecommandorderer.cs
- Rect3DValueSerializer.cs
- CapabilitiesAssignment.cs
- PathSegment.cs
- SqlPersonalizationProvider.cs
- TemplateLookupAction.cs
- AmbiguousMatchException.cs
- SqlWriter.cs
- SkinIDTypeConverter.cs
- ClientData.cs
- Positioning.cs
- NamedObject.cs
- SBCSCodePageEncoding.cs
- OptimalBreakSession.cs
- DataGridViewImageColumn.cs
- DataTableNewRowEvent.cs
- FtpWebRequest.cs
- ImageBrush.cs
- WindowShowOrOpenTracker.cs
- SecurityUtils.cs
- SoapServerProtocol.cs
- PriorityQueue.cs
- ActivityStateRecord.cs
- ResourceExpressionEditorSheet.cs
- Math.cs
- SafeCancelMibChangeNotify.cs
- BrowserCapabilitiesCodeGenerator.cs
- GetPageCompletedEventArgs.cs
- DataView.cs
- BindUriHelper.cs
- MsdtcClusterUtils.cs
- ResourcePool.cs
- AncillaryOps.cs
- SystemColorTracker.cs
- InputLangChangeRequestEvent.cs
- RestHandler.cs
- ProxyHwnd.cs
- GridViewSortEventArgs.cs
- FakeModelPropertyImpl.cs
- PieceDirectory.cs
- SystemUnicastIPAddressInformation.cs
- HelpEvent.cs
- XmlNodeChangedEventManager.cs
- infer.cs
- EventLogPermissionAttribute.cs
- StylusPointCollection.cs
- ContainerParagraph.cs
- CodeTypeDeclarationCollection.cs
- BaseCollection.cs
- CodeValidator.cs
- TraceData.cs
- DataGridColumnHeadersPresenter.cs
- PropertyItem.cs
- Application.cs
- XmlSchemaSimpleTypeUnion.cs
- TreeWalker.cs
- SqlCharStream.cs
- PathNode.cs
- SBCSCodePageEncoding.cs
- Conditional.cs
- DataGridViewRowPrePaintEventArgs.cs
- XslTransform.cs
- ResourceDictionaryCollection.cs
- LogicalExpressionTypeConverter.cs
- ErrorProvider.cs
- BitmapEffectOutputConnector.cs
- MutexSecurity.cs
- Panel.cs
- OracleInternalConnection.cs
- CharacterMetricsDictionary.cs