Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- SqlDelegatedTransaction.cs
- TransformDescriptor.cs
- InternalRelationshipCollection.cs
- PrimitiveCodeDomSerializer.cs
- ListViewItemMouseHoverEvent.cs
- CurrencyManager.cs
- ListCollectionView.cs
- Cursor.cs
- MemoryRecordBuffer.cs
- METAHEADER.cs
- WSHttpBinding.cs
- TextureBrush.cs
- EventMap.cs
- AttachedPropertyMethodSelector.cs
- TableColumnCollectionInternal.cs
- DoubleAnimationClockResource.cs
- SqlUserDefinedTypeAttribute.cs
- DependencyObject.cs
- RuleRefElement.cs
- FormViewUpdateEventArgs.cs
- SQLBinary.cs
- DaylightTime.cs
- DBSchemaTable.cs
- AsyncCompletedEventArgs.cs
- CrossSiteScriptingValidation.cs
- BaseCodePageEncoding.cs
- CompModHelpers.cs
- DataFieldConverter.cs
- WorkflowRuntimeServiceElementCollection.cs
- HtmlSelect.cs
- PassportPrincipal.cs
- UIInitializationException.cs
- OuterGlowBitmapEffect.cs
- AppModelKnownContentFactory.cs
- StringAnimationUsingKeyFrames.cs
- ProcessModuleCollection.cs
- ColumnMapVisitor.cs
- FuncTypeConverter.cs
- TemplateControlCodeDomTreeGenerator.cs
- CorrelationKey.cs
- MediaTimeline.cs
- XmlHierarchicalEnumerable.cs
- ReferenceSchema.cs
- PipelineModuleStepContainer.cs
- CatalogPart.cs
- SHA1.cs
- DataGridViewCellStateChangedEventArgs.cs
- StyleSelector.cs
- RecordBuilder.cs
- DynamicPhysicalDiscoSearcher.cs
- SqlDataSourceSelectingEventArgs.cs
- StateWorkerRequest.cs
- ExtendedPropertiesHandler.cs
- WorkflowMessageEventArgs.cs
- ExpandedWrapper.cs
- DashStyle.cs
- WaitHandle.cs
- CdpEqualityComparer.cs
- EvidenceTypeDescriptor.cs
- ImportDesigner.xaml.cs
- BindUriHelper.cs
- Selection.cs
- Slider.cs
- ExpressionBindings.cs
- TextServicesCompartmentEventSink.cs
- HttpRuntime.cs
- IgnoreDataMemberAttribute.cs
- SessionStateItemCollection.cs
- HwndSubclass.cs
- X509Utils.cs
- MimeBasePart.cs
- Choices.cs
- ListBase.cs
- BamlTreeUpdater.cs
- WebPartDeleteVerb.cs
- ObjectManager.cs
- BrowserCapabilitiesFactory.cs
- TextEncodedRawTextWriter.cs
- DataGridViewRowsAddedEventArgs.cs
- CopyCodeAction.cs
- SchemaElementLookUpTable.cs
- NavigatingCancelEventArgs.cs
- DataGridParentRows.cs
- SuppressMessageAttribute.cs
- DetailsViewRow.cs
- SecUtil.cs
- VariableBinder.cs
- QuestionEventArgs.cs
- VisualState.cs
- Number.cs
- TreeViewImageKeyConverter.cs
- InfocardExtendedInformationEntry.cs
- RenamedEventArgs.cs
- CodeSnippetStatement.cs
- FixedTextSelectionProcessor.cs
- BitVector32.cs
- InputReportEventArgs.cs
- MostlySingletonList.cs
- __ComObject.cs
- SecureUICommand.cs