Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebParts / CatalogPartCollection.cs / 1305376 / CatalogPartCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls.WebParts { using System; using System.Collections; using System.Globalization; 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); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls.WebParts { using System; using System.Collections; using System.Globalization; 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); } } } } } // 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
- QueryPageSettingsEventArgs.cs
- SourceFileInfo.cs
- TypeResolvingOptionsAttribute.cs
- TextElementAutomationPeer.cs
- DesignerForm.cs
- Color.cs
- StackSpiller.Bindings.cs
- ImageCollectionEditor.cs
- EmbeddedMailObjectCollectionEditor.cs
- CurrentChangingEventManager.cs
- ListenerAdapterBase.cs
- MediaPlayerState.cs
- StylusEditingBehavior.cs
- SmtpLoginAuthenticationModule.cs
- XmlSerializerNamespaces.cs
- ToolStripDropDown.cs
- SqlHelper.cs
- StaticTextPointer.cs
- FixedSOMPage.cs
- StylusShape.cs
- ArithmeticException.cs
- SpecialNameAttribute.cs
- RevocationPoint.cs
- OleDbErrorCollection.cs
- RuntimeConfigLKG.cs
- StorageBasedPackageProperties.cs
- StateMachineSubscription.cs
- SectionUpdates.cs
- XmlDeclaration.cs
- HealthMonitoringSectionHelper.cs
- GPRECT.cs
- ImpersonationContext.cs
- RelationshipEndCollection.cs
- DesignerLinkAdapter.cs
- _HeaderInfo.cs
- ColorMap.cs
- DispatcherTimer.cs
- WebReferenceOptions.cs
- PartialCachingControl.cs
- AsyncResult.cs
- EntityDataSourceDesignerHelper.cs
- Rules.cs
- Overlapped.cs
- MdiWindowListStrip.cs
- PolyLineSegment.cs
- ClientSettingsProvider.cs
- BrushValueSerializer.cs
- ToolStripRenderer.cs
- ObjectListFieldCollection.cs
- CheckBoxAutomationPeer.cs
- XmlHierarchicalEnumerable.cs
- VSWCFServiceContractGenerator.cs
- Regex.cs
- GridViewRowEventArgs.cs
- EdmComplexTypeAttribute.cs
- ReadOnlyAttribute.cs
- ColorPalette.cs
- SafePipeHandle.cs
- IteratorFilter.cs
- WriteTimeStream.cs
- CachedCompositeFamily.cs
- HostedElements.cs
- NativeCppClassAttribute.cs
- WebDisplayNameAttribute.cs
- HttpResponseInternalBase.cs
- ColumnMap.cs
- Style.cs
- DependsOnAttribute.cs
- ControlPropertyNameConverter.cs
- SQLBinaryStorage.cs
- QueryParameter.cs
- ExtendedPropertyCollection.cs
- XmlHierarchyData.cs
- DataGridViewComboBoxColumn.cs
- MethodCallTranslator.cs
- DataServiceRequestException.cs
- RectKeyFrameCollection.cs
- PersonalizableTypeEntry.cs
- RelationHandler.cs
- AnimationClock.cs
- VectorKeyFrameCollection.cs
- HealthMonitoringSectionHelper.cs
- BindingCompleteEventArgs.cs
- Utils.cs
- WindowsGraphicsCacheManager.cs
- PrivateFontCollection.cs
- newitemfactory.cs
- PenCursorManager.cs
- DesignerActionMethodItem.cs
- ScriptRegistrationManager.cs
- HttpApplicationFactory.cs
- RectAnimation.cs
- NewArrayExpression.cs
- ProviderConnectionPointCollection.cs
- PropertyChangedEventManager.cs
- EpmContentDeSerializerBase.cs
- HighContrastHelper.cs
- BaseProcessor.cs
- AuthenticationSection.cs
- SafeCancelMibChangeNotify.cs