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
- StorageFunctionMapping.cs
- DoubleCollection.cs
- PackagePart.cs
- TextContainerHelper.cs
- AttributeQuery.cs
- HierarchicalDataSourceControl.cs
- TreeNodeMouseHoverEvent.cs
- SmiContext.cs
- TraceUtility.cs
- XmlArrayAttribute.cs
- PermissionListSet.cs
- ReliableInputConnection.cs
- ClipboardData.cs
- HtmlTableRow.cs
- ArgumentsParser.cs
- CharAnimationUsingKeyFrames.cs
- AsmxEndpointPickerExtension.cs
- ConvertTextFrag.cs
- DoubleStorage.cs
- AsymmetricSecurityProtocolFactory.cs
- CellCreator.cs
- MetadataArtifactLoaderResource.cs
- SoapDocumentMethodAttribute.cs
- SchemaAttDef.cs
- ReaderWriterLockWrapper.cs
- ObjectMaterializedEventArgs.cs
- CodeTypeReferenceExpression.cs
- StrokeDescriptor.cs
- ApplicationDirectoryMembershipCondition.cs
- WindowsAltTab.cs
- XmlSchemaSimpleTypeList.cs
- QuotedStringFormatReader.cs
- arabicshape.cs
- FormClosingEvent.cs
- TableItemPattern.cs
- PerformanceCounter.cs
- BitmapMetadataEnumerator.cs
- SafeNativeMethodsCLR.cs
- PageCodeDomTreeGenerator.cs
- webproxy.cs
- FileInfo.cs
- WebBrowserProgressChangedEventHandler.cs
- ConfigurationStrings.cs
- Mapping.cs
- BaseTemplateCodeDomTreeGenerator.cs
- OleDbPermission.cs
- CloseCollectionAsyncResult.cs
- InvalidOperationException.cs
- FilterableAttribute.cs
- AudioBase.cs
- LayoutEngine.cs
- RuntimeCompatibilityAttribute.cs
- CodeDOMProvider.cs
- XmlComplianceUtil.cs
- CodeNamespace.cs
- GeometryConverter.cs
- TemplatedAdorner.cs
- ServiceModelConfiguration.cs
- AspNetSynchronizationContext.cs
- AsyncResult.cs
- EnumerableWrapperWeakToStrong.cs
- ComponentChangedEvent.cs
- VectorConverter.cs
- XmlDataCollection.cs
- UIPropertyMetadata.cs
- FunctionImportMapping.cs
- PerformanceCounterCategory.cs
- PkcsMisc.cs
- ItemCollection.cs
- loginstatus.cs
- GridViewSortEventArgs.cs
- QilInvokeLateBound.cs
- X509Certificate.cs
- HtmlTableCell.cs
- StyleCollection.cs
- BuildProvider.cs
- DbConnectionPoolGroupProviderInfo.cs
- HtmlInputHidden.cs
- UrlMappingsSection.cs
- IntSecurity.cs
- DataTablePropertyDescriptor.cs
- Polygon.cs
- returneventsaver.cs
- XmlSchemaValidationException.cs
- PageThemeParser.cs
- VoiceChangeEventArgs.cs
- RsaKeyIdentifierClause.cs
- DataRelationPropertyDescriptor.cs
- WebScriptServiceHostFactory.cs
- ValuePattern.cs
- Empty.cs
- Parameter.cs
- BaseCodePageEncoding.cs
- CodeArrayCreateExpression.cs
- Activation.cs
- PropertyGridCommands.cs
- AnnotationAdorner.cs
- SafeBitVector32.cs
- ThemeableAttribute.cs
- odbcmetadatacollectionnames.cs