Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / Configuration / ConvertersCollection.cs / 1305376 / 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.Web; using System.Web.Compilation; using System.Web.Resources; using System.Web.Script.Serialization; using System.Security; [ 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; } [SecuritySafeCritical] 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.Web; using System.Web.Compilation; using System.Web.Resources; using System.Web.Script.Serialization; using System.Security; [ 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; } [SecuritySafeCritical] 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
- PropertyToken.cs
- RequestCacheValidator.cs
- SiteMapProvider.cs
- WindowsGraphicsWrapper.cs
- DataGridClipboardHelper.cs
- StructuredTypeInfo.cs
- CustomErrorsSection.cs
- StandardCommands.cs
- Pair.cs
- SpecularMaterial.cs
- QueryStringHandler.cs
- returneventsaver.cs
- AppDomainManager.cs
- HostedTransportConfigurationManager.cs
- TextModifierScope.cs
- TdsParser.cs
- XMLSchema.cs
- ValueQuery.cs
- WinEventHandler.cs
- FacetEnabledSchemaElement.cs
- AvTraceFormat.cs
- InProcStateClientManager.cs
- PromptEventArgs.cs
- MobileResource.cs
- CodePrimitiveExpression.cs
- DataGridViewColumnConverter.cs
- PixelFormatConverter.cs
- FileDialogCustomPlace.cs
- FileDataSourceCache.cs
- OdbcCommand.cs
- CryptoHelper.cs
- TemplateNodeContextMenu.cs
- BrushMappingModeValidation.cs
- XmlSortKey.cs
- DataFormats.cs
- SystemIPGlobalStatistics.cs
- cookie.cs
- JsonServiceDocumentSerializer.cs
- ProcessHostConfigUtils.cs
- SafeArrayRankMismatchException.cs
- figurelengthconverter.cs
- TemplateBindingExpressionConverter.cs
- EventLogHandle.cs
- PagesChangedEventArgs.cs
- DeleteWorkflowOwnerCommand.cs
- ToolStrip.cs
- VariableBinder.cs
- NotImplementedException.cs
- PrePrepareMethodAttribute.cs
- NetworkStream.cs
- TextRangeEditTables.cs
- GridView.cs
- ButtonChrome.cs
- XmlElementCollection.cs
- AmbientLight.cs
- SafeEventLogWriteHandle.cs
- HtmlInputHidden.cs
- ImageIndexConverter.cs
- DBDataPermissionAttribute.cs
- RedirectionProxy.cs
- GroupItem.cs
- path.cs
- SEHException.cs
- ReadOnlyTernaryTree.cs
- WebServiceParameterData.cs
- InputScope.cs
- BaseTemplateParser.cs
- PageThemeBuildProvider.cs
- ArrayWithOffset.cs
- WebResponse.cs
- ItemsChangedEventArgs.cs
- Paragraph.cs
- TabPanel.cs
- TraceSource.cs
- LambdaCompiler.cs
- ConnectionInterfaceCollection.cs
- DiffuseMaterial.cs
- ITreeGenerator.cs
- StylusPlugInCollection.cs
- PartialCachingControl.cs
- TextComposition.cs
- MultiSelectRootGridEntry.cs
- InnerItemCollectionView.cs
- LocalIdKeyIdentifierClause.cs
- InternalDispatchObject.cs
- Semaphore.cs
- XhtmlBasicListAdapter.cs
- Root.cs
- ProcessHostConfigUtils.cs
- TimeSpanValidator.cs
- DesignerActionList.cs
- WindowsAuthenticationModule.cs
- HostingEnvironmentException.cs
- ExpressionVisitor.cs
- x509utils.cs
- ConsumerConnectionPointCollection.cs
- RoleManagerModule.cs
- MouseDevice.cs
- Quack.cs
- XmlSchemaImport.cs