Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / xsp / System / Web / Extensions / Configuration / ConvertersCollection.cs / 2 / 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.Security.Permissions; using System.Web; using System.Web.Compilation; using System.Web.Resources; using System.Web.Script.Serialization; [ AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal), 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; } 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.Security.Permissions; using System.Web; using System.Web.Compilation; using System.Web.Resources; using System.Web.Script.Serialization; [ AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal), 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; } 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
- XmlCDATASection.cs
- CodeChecksumPragma.cs
- ActivationServices.cs
- LayoutTableCell.cs
- AsymmetricSignatureDeformatter.cs
- OutputCacheSection.cs
- XslVisitor.cs
- GeometryGroup.cs
- XmlTextWriter.cs
- WebEventCodes.cs
- Graphics.cs
- HtmlInputPassword.cs
- CodeBlockBuilder.cs
- PerformanceCounterCategory.cs
- OptionalColumn.cs
- CngKeyCreationParameters.cs
- Win32.cs
- SpotLight.cs
- VersionedStreamOwner.cs
- IBuiltInEvidence.cs
- LinkButton.cs
- HyperLink.cs
- SafeThemeHandle.cs
- sqlmetadatafactory.cs
- CommandSet.cs
- NetworkInformationException.cs
- WebBrowser.cs
- RegexFCD.cs
- HMACRIPEMD160.cs
- UnsafeNativeMethods.cs
- CodeDOMProvider.cs
- IPipelineRuntime.cs
- MetabaseReader.cs
- MsmqEncryptionAlgorithm.cs
- DataSourceView.cs
- XmlText.cs
- DetailsViewUpdateEventArgs.cs
- OnOperation.cs
- RequiredFieldValidator.cs
- HtmlShim.cs
- WebBrowserUriTypeConverter.cs
- ValueOfAction.cs
- ComplexType.cs
- EdmConstants.cs
- HelpKeywordAttribute.cs
- AnnotationAdorner.cs
- PropertyGridEditorPart.cs
- StringBuilder.cs
- ConcurrentBag.cs
- ToolStrip.cs
- PolicyStatement.cs
- ConnectionConsumerAttribute.cs
- SafeEventLogWriteHandle.cs
- SchemaElementLookUpTable.cs
- CachedRequestParams.cs
- EdmToObjectNamespaceMap.cs
- CompilerTypeWithParams.cs
- QilFunction.cs
- HtmlMobileTextWriter.cs
- SymbolTable.cs
- WebServiceClientProxyGenerator.cs
- ValueProviderWrapper.cs
- JpegBitmapEncoder.cs
- TextServicesCompartment.cs
- CompilerGeneratedAttribute.cs
- RadioButtonFlatAdapter.cs
- _ShellExpression.cs
- CompiledRegexRunner.cs
- ExpressionLexer.cs
- ConfigurationManagerInternalFactory.cs
- TdsParserSafeHandles.cs
- XmlDocument.cs
- XmlSchemaSubstitutionGroup.cs
- SqlFileStream.cs
- ContractListAdapter.cs
- MemberAssignmentAnalysis.cs
- PackageDigitalSignatureManager.cs
- TextClipboardData.cs
- OperandQuery.cs
- CommandField.cs
- FunctionImportMapping.cs
- HttpWriter.cs
- FixedSOMPage.cs
- ApplicationSecurityInfo.cs
- IODescriptionAttribute.cs
- CompositeActivityTypeDescriptor.cs
- DataSourceControlBuilder.cs
- ConvertEvent.cs
- ListViewPagedDataSource.cs
- BaseDataBoundControl.cs
- DocumentCollection.cs
- ReversePositionQuery.cs
- AttachmentService.cs
- ToggleProviderWrapper.cs
- PictureBoxDesigner.cs
- TimeSpanValidator.cs
- ExpressionBuilderCollection.cs
- XmlSchemaAnnotation.cs
- BoundColumn.cs
- CompModSwitches.cs