Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebParts / CatalogPartCollection.cs / 1 / CatalogPartCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls.WebParts { using System; using System.Collections; using System.Globalization; using System.Security.Permissions; [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class CatalogPartCollection : ReadOnlyCollectionBase { public static readonly CatalogPartCollection Empty = new CatalogPartCollection(); public CatalogPartCollection() { } public CatalogPartCollection(ICollection catalogParts) { Initialize(null, catalogParts); } public CatalogPartCollection(CatalogPartCollection existingCatalogParts, ICollection catalogParts) { Initialize(existingCatalogParts, catalogParts); } public CatalogPart this[int index] { get { return (CatalogPart) InnerList[index]; } } public CatalogPart this[string id] { get { foreach (CatalogPart catalogPart in InnerList) { if (String.Equals(catalogPart.ID, id, StringComparison.OrdinalIgnoreCase)) { return catalogPart; } } return null; } } internal int Add(CatalogPart value) { return InnerList.Add(value); } public bool Contains(CatalogPart catalogPart) { return InnerList.Contains(catalogPart); } public void CopyTo(CatalogPart[] array, int index) { InnerList.CopyTo(array, index); } public int IndexOf(CatalogPart catalogPart) { return InnerList.IndexOf(catalogPart); } private void Initialize(CatalogPartCollection existingCatalogParts, ICollection catalogParts) { if (existingCatalogParts != null) { foreach (CatalogPart existingCatalogPart in existingCatalogParts) { // Don't need to check arg, since we know it is valid since it came // from a CatalogPartCollection. InnerList.Add(existingCatalogPart); } } if (catalogParts != null) { foreach (object obj in catalogParts) { if (obj == null) { throw new ArgumentException(SR.GetString(SR.Collection_CantAddNull), "catalogParts"); } if (!(obj is CatalogPart)) { throw new ArgumentException(SR.GetString(SR.Collection_InvalidType, "CatalogPart"), "catalogParts"); } InnerList.Add(obj); } } } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FormsAuthenticationEventArgs.cs
- EntityCollection.cs
- HttpRequestMessageProperty.cs
- GradientStop.cs
- DecoderNLS.cs
- BoundsDrawingContextWalker.cs
- HandleExceptionArgs.cs
- Localizer.cs
- TextTreeInsertElementUndoUnit.cs
- DirectionalLight.cs
- DefaultPropertyAttribute.cs
- ObjectMemberMapping.cs
- DataServiceRequestException.cs
- TextParentUndoUnit.cs
- DefaultValueConverter.cs
- JoinCqlBlock.cs
- XsltQilFactory.cs
- ReflectionUtil.cs
- SafeHandle.cs
- OleDbReferenceCollection.cs
- ModuleBuilderData.cs
- AssemblyInfo.cs
- FilePresentation.cs
- DbResourceAllocator.cs
- EndOfStreamException.cs
- ObjectTag.cs
- TemplateComponentConnector.cs
- XmlSerializationWriter.cs
- StrongNamePublicKeyBlob.cs
- ProgressBar.cs
- RemoteWebConfigurationHostServer.cs
- ValidatorUtils.cs
- SplitterPanel.cs
- ServiceProviders.cs
- TextRangeEditLists.cs
- PrePostDescendentsWalker.cs
- XNodeValidator.cs
- Choices.cs
- TreeNodeBindingCollection.cs
- CmsUtils.cs
- HttpProfileGroupBase.cs
- GridViewDeletedEventArgs.cs
- DashStyle.cs
- HideDisabledControlAdapter.cs
- HttpCookie.cs
- StreamWriter.cs
- TextSerializer.cs
- ProtocolsConfiguration.cs
- Bits.cs
- ReliableOutputConnection.cs
- WSSecurityPolicy12.cs
- Model3D.cs
- ReadingWritingEntityEventArgs.cs
- CheckableControlBaseAdapter.cs
- DiscoveryVersionConverter.cs
- cryptoapiTransform.cs
- SemaphoreFullException.cs
- DesignerActionUIService.cs
- EventLogTraceListener.cs
- RemoteWebConfigurationHost.cs
- EmptyStringExpandableObjectConverter.cs
- TextElementEnumerator.cs
- Grant.cs
- AddInActivator.cs
- ObfuscateAssemblyAttribute.cs
- WebServiceBindingAttribute.cs
- AppDomainShutdownMonitor.cs
- X509Utils.cs
- HttpException.cs
- SoapExtensionTypeElementCollection.cs
- ImageField.cs
- BuildProviderUtils.cs
- SHA512.cs
- TextInfo.cs
- OpCellTreeNode.cs
- KnownTypeAttribute.cs
- PropertyFilterAttribute.cs
- clipboard.cs
- GridViewColumnHeader.cs
- SourceItem.cs
- BooleanFunctions.cs
- DispatchChannelSink.cs
- MgmtResManager.cs
- StringArrayConverter.cs
- ScalarOps.cs
- CompositeCollectionView.cs
- UInt64.cs
- TimeoutValidationAttribute.cs
- TreeNodeMouseHoverEvent.cs
- AuthenticationModuleElementCollection.cs
- ProtocolViolationException.cs
- QueryCursorEventArgs.cs
- WebServiceHost.cs
- ScrollEventArgs.cs
- SchemaCollectionCompiler.cs
- EntityContainerEmitter.cs
- HeaderedContentControl.cs
- RectangleHotSpot.cs
- TypeUnloadedException.cs
- NotImplementedException.cs