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
- TdsParser.cs
- ErrorProvider.cs
- ControlCommandSet.cs
- DefaultAsyncDataDispatcher.cs
- ProvideValueServiceProvider.cs
- CriticalHandle.cs
- X509AsymmetricSecurityKey.cs
- JournalEntry.cs
- DynamicActionMessageFilter.cs
- ResourceDisplayNameAttribute.cs
- CompilerParameters.cs
- ProxyElement.cs
- PropertyDescriptorGridEntry.cs
- PathFigure.cs
- NavigationHelper.cs
- Sql8ExpressionRewriter.cs
- SiteMapProvider.cs
- ReturnType.cs
- NavigatingCancelEventArgs.cs
- Win32Exception.cs
- WebPartUtil.cs
- SetState.cs
- RelationshipNavigation.cs
- XamlTypeMapper.cs
- ObjectDataProvider.cs
- TrueReadOnlyCollection.cs
- StandardOleMarshalObject.cs
- LazyTextWriterCreator.cs
- FormViewDeletedEventArgs.cs
- SqlDelegatedTransaction.cs
- ColorMap.cs
- Error.cs
- RadioButtonStandardAdapter.cs
- CommandPlan.cs
- TargetInvocationException.cs
- KerberosReceiverSecurityToken.cs
- SchemaElementDecl.cs
- Transform3D.cs
- DictionaryContent.cs
- PriorityBinding.cs
- ModuleBuilder.cs
- ConfigurationSectionCollection.cs
- EndpointIdentity.cs
- MaterialGroup.cs
- _FtpControlStream.cs
- TileBrush.cs
- KeyProperty.cs
- ErrorRuntimeConfig.cs
- DatagridviewDisplayedBandsData.cs
- SudsParser.cs
- DBCommand.cs
- HttpProfileGroupBase.cs
- TextRenderer.cs
- JsonSerializer.cs
- ProgressChangedEventArgs.cs
- Visual3DCollection.cs
- SecurityContextSecurityToken.cs
- ListComponentEditorPage.cs
- AssertFilter.cs
- Attachment.cs
- ElementProxy.cs
- ImmutableObjectAttribute.cs
- DropShadowBitmapEffect.cs
- UIHelper.cs
- ThreadAttributes.cs
- ClientUtils.cs
- ReadOnlyNameValueCollection.cs
- FunctionDefinition.cs
- IList.cs
- ProfileServiceManager.cs
- HttpCachePolicyElement.cs
- NullableDecimalSumAggregationOperator.cs
- DataListItem.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- ObjectIDGenerator.cs
- dbdatarecord.cs
- PrimitiveOperationFormatter.cs
- MULTI_QI.cs
- SqlFileStream.cs
- AutoGeneratedField.cs
- InertiaTranslationBehavior.cs
- Metafile.cs
- BamlResourceContent.cs
- ListViewCommandEventArgs.cs
- XmlUtil.cs
- WebPartsSection.cs
- Rijndael.cs
- QilList.cs
- NativeMethodsOther.cs
- PropagatorResult.cs
- PageContentCollection.cs
- PrinterUnitConvert.cs
- InkCanvas.cs
- StrokeDescriptor.cs
- RequiredArgumentAttribute.cs
- WebCategoryAttribute.cs
- MdbDataFileEditor.cs
- SvcMapFileLoader.cs
- FacetValues.cs
- ListViewGroupConverter.cs