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
- FileUtil.cs
- Glyph.cs
- HashCodeCombiner.cs
- CurrentChangedEventManager.cs
- ListItemConverter.cs
- SqlDataSourceConfigureSelectPanel.cs
- DocumentPageView.cs
- ALinqExpressionVisitor.cs
- EdmProperty.cs
- SecurityContext.cs
- CommentGlyph.cs
- SmiEventSink_Default.cs
- LogLogRecordEnumerator.cs
- SubpageParagraph.cs
- CfgParser.cs
- complextypematerializer.cs
- UniqueIdentifierService.cs
- BitStack.cs
- GridViewCancelEditEventArgs.cs
- DataRecordInfo.cs
- TextPenaltyModule.cs
- Validator.cs
- HttpCapabilitiesSectionHandler.cs
- StateMachineHelpers.cs
- ConfigurationSectionGroup.cs
- UInt32.cs
- UserCancellationException.cs
- NamedPermissionSet.cs
- ListView.cs
- HwndProxyElementProvider.cs
- UpdateTracker.cs
- DbSource.cs
- BamlRecordHelper.cs
- FileDialog.cs
- ViewCellSlot.cs
- BitmapPalettes.cs
- FreezableCollection.cs
- HandleRef.cs
- ModuleConfigurationInfo.cs
- ObjectToken.cs
- ComponentResourceKey.cs
- ActivityTypeDesigner.xaml.cs
- SiteMapNodeCollection.cs
- SHA1CryptoServiceProvider.cs
- Array.cs
- SqlCacheDependencySection.cs
- _KerberosClient.cs
- XamlPointCollectionSerializer.cs
- StructuralType.cs
- ShaderEffect.cs
- LazyLoadBehavior.cs
- DictionaryChange.cs
- LocalizationComments.cs
- GradientSpreadMethodValidation.cs
- KeyValueConfigurationElement.cs
- IssuanceLicense.cs
- SystemIPGlobalProperties.cs
- Profiler.cs
- DbMetaDataColumnNames.cs
- PenLineJoinValidation.cs
- DriveNotFoundException.cs
- ImportCatalogPart.cs
- PropertyValueChangedEvent.cs
- ImageEditor.cs
- SkinIDTypeConverter.cs
- PageHandlerFactory.cs
- EdmProviderManifest.cs
- Base64Stream.cs
- SHA512.cs
- TimeoutException.cs
- PersonalizationDictionary.cs
- NodeFunctions.cs
- WindowsAuthenticationEventArgs.cs
- Tablet.cs
- MainMenu.cs
- HashHelper.cs
- XPathNodeInfoAtom.cs
- Panel.cs
- ProtocolsSection.cs
- TextDecorationLocationValidation.cs
- CacheChildrenQuery.cs
- PtsHost.cs
- mansign.cs
- IndicFontClient.cs
- SQLDateTime.cs
- EventLogEntry.cs
- ParsedAttributeCollection.cs
- MimeParameters.cs
- FormClosedEvent.cs
- HttpModuleActionCollection.cs
- UnsafeNativeMethods.cs
- CommandID.cs
- ControlParameter.cs
- GridErrorDlg.cs
- DateTimeConstantAttribute.cs
- ExpressionServices.cs
- ApplicationTrust.cs
- GatewayDefinition.cs
- CompilerCollection.cs
- MenuItemStyleCollectionEditor.cs