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
- RtfFormatStack.cs
- HttpHeaderCollection.cs
- CqlParser.cs
- OdbcTransaction.cs
- LabelDesigner.cs
- DynamicControl.cs
- WindowsScrollBar.cs
- WebPartConnection.cs
- SqlStatistics.cs
- InheritablePropertyChangeInfo.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- XPathParser.cs
- URLAttribute.cs
- ObsoleteAttribute.cs
- DataGridAutoFormat.cs
- FileEnumerator.cs
- regiisutil.cs
- KeyInterop.cs
- FileVersionInfo.cs
- AccessedThroughPropertyAttribute.cs
- DecimalConverter.cs
- RowVisual.cs
- TableItemProviderWrapper.cs
- ListControlConvertEventArgs.cs
- PersonalizablePropertyEntry.cs
- RectangleHotSpot.cs
- ExecutedRoutedEventArgs.cs
- SafeNativeMethodsMilCoreApi.cs
- Group.cs
- CalendarDay.cs
- AppDomain.cs
- TabItemAutomationPeer.cs
- TraceContextRecord.cs
- SoapDocumentMethodAttribute.cs
- Schedule.cs
- ParallelQuery.cs
- WindowsTreeView.cs
- SecurityTokenException.cs
- TreeNodeCollection.cs
- ColumnResizeUndoUnit.cs
- SessionSwitchEventArgs.cs
- SamlSecurityTokenAuthenticator.cs
- TypeLibraryHelper.cs
- ResourceDescriptionAttribute.cs
- AxImporter.cs
- Marshal.cs
- wgx_commands.cs
- DefaultMemberAttribute.cs
- EventLogPermissionEntry.cs
- TdsParameterSetter.cs
- QueryReaderSettings.cs
- CorrelationInitializer.cs
- MatrixTransform3D.cs
- CheckBoxBaseAdapter.cs
- XmlNodeList.cs
- CorePropertiesFilter.cs
- HtmlTextArea.cs
- ExpressionBindings.cs
- Pool.cs
- _TLSstream.cs
- EventHandlerService.cs
- InputLanguageCollection.cs
- QueryModel.cs
- ErrorCodes.cs
- ExtenderControl.cs
- ReceiveContextCollection.cs
- IgnoreDeviceFilterElementCollection.cs
- SID.cs
- DPCustomTypeDescriptor.cs
- UInt16Converter.cs
- AlgoModule.cs
- WsdlBuildProvider.cs
- ModuleElement.cs
- BitmapFrame.cs
- ProfilePropertyMetadata.cs
- StateMachineHistory.cs
- TextDecorationCollection.cs
- ObjectViewFactory.cs
- SchemaTableOptionalColumn.cs
- CookielessHelper.cs
- PermissionAttributes.cs
- Command.cs
- ButtonChrome.cs
- GeometryHitTestResult.cs
- XsltQilFactory.cs
- AttributeUsageAttribute.cs
- PolicyValidator.cs
- _OSSOCK.cs
- UIElement.cs
- RequestTimeoutManager.cs
- FunctionImportElement.cs
- ButtonRenderer.cs
- Preprocessor.cs
- SQLByteStorage.cs
- CodeAttachEventStatement.cs
- DataObjectEventArgs.cs
- Line.cs
- ColumnResizeAdorner.cs
- StringToken.cs
- DiscoveryOperationContext.cs