Code:
/ DotNET / DotNET / 8.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
- SelectedDatesCollection.cs
- WindowsRichEditRange.cs
- Vector3D.cs
- PowerStatus.cs
- SpeechUI.cs
- assertwrapper.cs
- TrustManager.cs
- CompositeDispatchFormatter.cs
- XmlILStorageConverter.cs
- DataGridViewCheckBoxCell.cs
- ResourceCategoryAttribute.cs
- ListViewPagedDataSource.cs
- Exceptions.cs
- RawMouseInputReport.cs
- XmlFormatExtensionPrefixAttribute.cs
- DrawingAttributeSerializer.cs
- Tablet.cs
- HttpModuleActionCollection.cs
- LockedHandleGlyph.cs
- Grid.cs
- HostingEnvironmentWrapper.cs
- ArgumentException.cs
- SQLDecimal.cs
- DiscoveryOperationContext.cs
- RepeaterCommandEventArgs.cs
- SerTrace.cs
- ProfilePropertyMetadata.cs
- DynamicUpdateCommand.cs
- NullableFloatSumAggregationOperator.cs
- Accessible.cs
- CompilerHelpers.cs
- ClientEventManager.cs
- XPathSelectionIterator.cs
- SharedHttpTransportManager.cs
- NetNamedPipeSecurityMode.cs
- OletxDependentTransaction.cs
- HttpHandlerActionCollection.cs
- TypeUtils.cs
- UpdateDelegates.Generated.cs
- BrowserCapabilitiesCodeGenerator.cs
- BulletDecorator.cs
- HotSpotCollection.cs
- Formatter.cs
- WsdlBuildProvider.cs
- MsmqIntegrationSecurity.cs
- SocketException.cs
- RectangleHotSpot.cs
- HttpWebRequestElement.cs
- LexicalChunk.cs
- InvalidateEvent.cs
- FilterableAttribute.cs
- RegexWorker.cs
- BuildProviderCollection.cs
- Registry.cs
- GridEntryCollection.cs
- DrawingContextWalker.cs
- EntityFrameworkVersions.cs
- ToolboxComponentsCreatedEventArgs.cs
- EdmComplexTypeAttribute.cs
- StateBag.cs
- TextSpanModifier.cs
- PersonalizationStateInfo.cs
- Rijndael.cs
- XamlToRtfWriter.cs
- AddingNewEventArgs.cs
- FirstQueryOperator.cs
- DirectionalLight.cs
- Aggregates.cs
- UntypedNullExpression.cs
- ReadOnlyDataSource.cs
- DataSetUtil.cs
- SchemaManager.cs
- PointF.cs
- SqlOuterApplyReducer.cs
- RenderDataDrawingContext.cs
- InstancePersistenceCommand.cs
- RoutedEvent.cs
- UnaryExpression.cs
- ContextMenu.cs
- XmlIgnoreAttribute.cs
- TrackingStringDictionary.cs
- HtmlElementErrorEventArgs.cs
- Base64Decoder.cs
- SpecularMaterial.cs
- PeerApplicationLaunchInfo.cs
- DecoderNLS.cs
- ConditionalAttribute.cs
- _ListenerRequestStream.cs
- LogRecordSequence.cs
- Peer.cs
- MessageLoggingFilterTraceRecord.cs
- ManagementObjectCollection.cs
- XmlNavigatorFilter.cs
- LookupNode.cs
- XmlBoundElement.cs
- FontUnit.cs
- CmsInterop.cs
- smtpconnection.cs
- InheritanceAttribute.cs
- mactripleDES.cs