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
- ToolBarOverflowPanel.cs
- TreeIterators.cs
- DrawingGroup.cs
- ComponentDispatcherThread.cs
- SupportingTokenParameters.cs
- ExpressionQuoter.cs
- RowTypeElement.cs
- columnmapfactory.cs
- InfocardExtendedInformationEntry.cs
- PlaceHolder.cs
- BuildDependencySet.cs
- ObjectDataSourceWizardForm.cs
- PersonalizationProviderCollection.cs
- DataControlFieldHeaderCell.cs
- errorpatternmatcher.cs
- ActivityCodeDomSerializationManager.cs
- IntSecurity.cs
- MonitorWrapper.cs
- TraceListeners.cs
- StringArrayConverter.cs
- RequiredFieldValidator.cs
- UseAttributeSetsAction.cs
- Calendar.cs
- GridItem.cs
- unitconverter.cs
- StringCollection.cs
- StringHandle.cs
- EventLogLink.cs
- TextEditorParagraphs.cs
- Metafile.cs
- HideDisabledControlAdapter.cs
- HttpListener.cs
- Bold.cs
- TreeView.cs
- counter.cs
- EventProviderWriter.cs
- DataSetUtil.cs
- InkCanvasAutomationPeer.cs
- DataColumnMapping.cs
- SelectionHighlightInfo.cs
- BezierSegment.cs
- EventLogger.cs
- Pair.cs
- XmlC14NWriter.cs
- OleDbTransaction.cs
- BreakRecordTable.cs
- Tool.cs
- BitmapEffect.cs
- ChildDocumentBlock.cs
- ImageMetadata.cs
- GatewayIPAddressInformationCollection.cs
- Oid.cs
- SerializableAttribute.cs
- GenericWebPart.cs
- ContentTextAutomationPeer.cs
- TableLayoutStyleCollection.cs
- HttpBrowserCapabilitiesWrapper.cs
- ProfileEventArgs.cs
- UshortList2.cs
- OdbcTransaction.cs
- propertyentry.cs
- TextEditorCopyPaste.cs
- AnonymousIdentificationModule.cs
- QilList.cs
- TargetPerspective.cs
- GeometryCombineModeValidation.cs
- XmlObjectSerializerContext.cs
- UInt32Storage.cs
- PropertyEmitterBase.cs
- GAC.cs
- InputBuffer.cs
- WebBrowserHelper.cs
- ObjectContextServiceProvider.cs
- Journaling.cs
- DisplayMemberTemplateSelector.cs
- CustomTypeDescriptor.cs
- Win32.cs
- PowerModeChangedEventArgs.cs
- TabletCollection.cs
- AssociationTypeEmitter.cs
- SamlAuthorizationDecisionClaimResource.cs
- FormatterServicesNoSerializableCheck.cs
- SmtpNtlmAuthenticationModule.cs
- SpellerHighlightLayer.cs
- TypeSource.cs
- DependsOnAttribute.cs
- ServiceElementCollection.cs
- EventProxy.cs
- DataGridViewColumn.cs
- InternalMappingException.cs
- SystemWebSectionGroup.cs
- ArrayConverter.cs
- PageRequestManager.cs
- NativeMethods.cs
- PeerApplication.cs
- SortDescriptionCollection.cs
- LocalizedNameDescriptionPair.cs
- CodeValidator.cs
- webproxy.cs
- SignedXml.cs