Code:
/ DotNET / DotNET / 8.0 / untmp / Orcas / RTM / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AppDomain.cs
- ListSortDescription.cs
- InstanceOwnerException.cs
- Form.cs
- StrongTypingException.cs
- BamlVersionHeader.cs
- StreamGeometry.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- ApplicationFileParser.cs
- OdbcPermission.cs
- WebServiceParameterData.cs
- FormattedTextSymbols.cs
- DatatypeImplementation.cs
- TabletDevice.cs
- TrackingCondition.cs
- Translator.cs
- MemoryRecordBuffer.cs
- CatchBlock.cs
- BindValidator.cs
- SecurityKeyIdentifierClause.cs
- TemplateNameScope.cs
- MulticastDelegate.cs
- OutputCacheSettingsSection.cs
- SqlClientFactory.cs
- TakeOrSkipQueryOperator.cs
- RequestCachingSection.cs
- Function.cs
- NativeObjectSecurity.cs
- Restrictions.cs
- WebResourceUtil.cs
- SuppressMergeCheckAttribute.cs
- SharedUtils.cs
- UnescapedXmlDiagnosticData.cs
- ProcessStartInfo.cs
- WindowsServiceElement.cs
- Baml2006ReaderSettings.cs
- InfoCardCryptoHelper.cs
- WebPartEditVerb.cs
- ipaddressinformationcollection.cs
- TreeViewCancelEvent.cs
- PeerName.cs
- XPathAncestorIterator.cs
- ComponentDispatcherThread.cs
- autovalidator.cs
- CompressionTransform.cs
- DataStreamFromComStream.cs
- MenuItemBindingCollection.cs
- Preprocessor.cs
- QuotedPrintableStream.cs
- LinkButton.cs
- MULTI_QI.cs
- SamlSecurityTokenAuthenticator.cs
- CriticalHandle.cs
- DelegateSerializationHolder.cs
- PerformanceCountersElement.cs
- ComponentResourceKeyConverter.cs
- AbandonedMutexException.cs
- DebugView.cs
- InputLanguageSource.cs
- ParseChildrenAsPropertiesAttribute.cs
- FixedSOMTableRow.cs
- GroupBox.cs
- WinEventWrap.cs
- NullEntityWrapper.cs
- FromReply.cs
- DataGridViewCellStyle.cs
- HTTPNotFoundHandler.cs
- AndCondition.cs
- ProviderIncompatibleException.cs
- XmlCharType.cs
- SatelliteContractVersionAttribute.cs
- PropertyInformation.cs
- LongTypeConverter.cs
- StrongName.cs
- TabPanel.cs
- DES.cs
- _FtpControlStream.cs
- LocalBuilder.cs
- HierarchicalDataTemplate.cs
- StateMachine.cs
- DataReceivedEventArgs.cs
- XamlReader.cs
- CachedFontFace.cs
- _SslStream.cs
- TraceSection.cs
- DependencyPropertyDescriptor.cs
- NonParentingControl.cs
- ExpressionHelper.cs
- FormViewInsertedEventArgs.cs
- EmbossBitmapEffect.cs
- codemethodreferenceexpression.cs
- Literal.cs
- Imaging.cs
- OptimizedTemplateContentHelper.cs
- ErrorRuntimeConfig.cs
- DateTimeConverter2.cs
- WorkflowPrinting.cs
- DataGridViewAutoSizeModeEventArgs.cs
- RemoteHelper.cs
- FunctionImportMapping.cs