Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FixedSOMSemanticBox.cs
- ISAPIRuntime.cs
- DefaultAsyncDataDispatcher.cs
- TemplateApplicationHelper.cs
- InvalidDataException.cs
- SmiEventSink.cs
- DataViewSetting.cs
- SlipBehavior.cs
- QueryPageSettingsEventArgs.cs
- brushes.cs
- SqlTopReducer.cs
- ListItemCollection.cs
- CodeFieldReferenceExpression.cs
- filewebresponse.cs
- InvokePattern.cs
- NumberSubstitution.cs
- AsmxEndpointPickerExtension.cs
- DiagnosticTraceSchemas.cs
- ProfilePropertySettings.cs
- SchemaImporterExtensionElement.cs
- MenuItem.cs
- ConfigXmlAttribute.cs
- EndPoint.cs
- CodeTypeParameterCollection.cs
- KnowledgeBase.cs
- _FtpDataStream.cs
- IDQuery.cs
- TableLayoutPanelDesigner.cs
- TaiwanCalendar.cs
- WindowsRichEdit.cs
- OleDbStruct.cs
- PhysicalOps.cs
- LineVisual.cs
- XmlExceptionHelper.cs
- ClaimTypeRequirement.cs
- TextBoxBase.cs
- HMACSHA1.cs
- WeakEventTable.cs
- ServicePoint.cs
- XmlTextWriter.cs
- ResizeGrip.cs
- FlowLayoutPanel.cs
- GenericPrincipal.cs
- OdbcStatementHandle.cs
- HScrollProperties.cs
- UIAgentRequest.cs
- ComponentManagerBroker.cs
- StrokeIntersection.cs
- InternalConfigRoot.cs
- BamlRecordHelper.cs
- QueryCursorEventArgs.cs
- DictionaryManager.cs
- DataTable.cs
- WeakEventTable.cs
- RelationalExpressions.cs
- Publisher.cs
- VirtualPathProvider.cs
- UnsafeNativeMethods.cs
- InstanceCreationEditor.cs
- EdmComplexPropertyAttribute.cs
- ShapeTypeface.cs
- LineServicesRun.cs
- FileDialog_Vista.cs
- filewebrequest.cs
- DataConnectionHelper.cs
- SafeLibraryHandle.cs
- FontDialog.cs
- HwndMouseInputProvider.cs
- Queue.cs
- ColumnClickEvent.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- XmlILOptimizerVisitor.cs
- TransformBlockRequest.cs
- XPathDocumentNavigator.cs
- StandardCommands.cs
- SafeRegistryKey.cs
- ReadOnlyPropertyMetadata.cs
- ArraySet.cs
- ManifestSignedXml.cs
- ClearTypeHintValidation.cs
- DataTable.cs
- RectAnimationClockResource.cs
- XmlWriterDelegator.cs
- AttributedMetaModel.cs
- HtmlControlPersistable.cs
- RectangleGeometry.cs
- TileBrush.cs
- DoubleStorage.cs
- PageParserFilter.cs
- ArraySortHelper.cs
- X509Certificate.cs
- SuppressIldasmAttribute.cs
- OrderPreservingPipeliningSpoolingTask.cs
- FlagsAttribute.cs
- InstanceLockException.cs
- ByteArrayHelperWithString.cs
- XmlCharacterData.cs
- FtpWebRequest.cs
- SiteMapDataSource.cs