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
- ValueConversionAttribute.cs
- X509ClientCertificateAuthentication.cs
- StylusShape.cs
- DynamicPropertyReader.cs
- RegexBoyerMoore.cs
- Converter.cs
- RowUpdatedEventArgs.cs
- ObjectPersistData.cs
- PointLight.cs
- BindMarkupExtensionSerializer.cs
- ProviderConnectionPointCollection.cs
- Query.cs
- DrawingAttributes.cs
- _WinHttpWebProxyDataBuilder.cs
- PreservationFileWriter.cs
- RepeaterItemCollection.cs
- GeometryCollection.cs
- FindProgressChangedEventArgs.cs
- InfocardChannelParameter.cs
- Stylesheet.cs
- RelationshipEndCollection.cs
- TreeView.cs
- FontStyles.cs
- ObjectToken.cs
- QueueProcessor.cs
- Transform3DGroup.cs
- WorkflowMarkupSerializer.cs
- TemplateControl.cs
- DataGridViewAddColumnDialog.cs
- Assign.cs
- UnsafeNativeMethodsTablet.cs
- OptimalTextSource.cs
- FormattedTextSymbols.cs
- DesignerDataStoredProcedure.cs
- Model3DCollection.cs
- AxisAngleRotation3D.cs
- BlobPersonalizationState.cs
- DoWorkEventArgs.cs
- ECDsaCng.cs
- TypeUtils.cs
- ToolboxControl.cs
- Menu.cs
- TextEditorTables.cs
- OdbcRowUpdatingEvent.cs
- TextTreeDeleteContentUndoUnit.cs
- HttpCapabilitiesEvaluator.cs
- BrowsableAttribute.cs
- SqlSupersetValidator.cs
- FixedSOMLineRanges.cs
- StylusPointCollection.cs
- PreviousTrackingServiceAttribute.cs
- DataGridColumn.cs
- MethodExecutor.cs
- EdmTypeAttribute.cs
- DoubleAnimationUsingKeyFrames.cs
- NavigationPropertyEmitter.cs
- SetterBaseCollection.cs
- BuildProvider.cs
- DbFunctionCommandTree.cs
- ArcSegment.cs
- HotSpot.cs
- HttpListener.cs
- DocumentApplication.cs
- WebPartTransformerAttribute.cs
- HtmlControlPersistable.cs
- SortQueryOperator.cs
- Matrix3D.cs
- TextInfo.cs
- PageHandlerFactory.cs
- BamlLocalizabilityResolver.cs
- LZCodec.cs
- IPEndPointCollection.cs
- DefaultSerializationProviderAttribute.cs
- PriorityQueue.cs
- DataServiceProcessingPipelineEventArgs.cs
- DbProviderSpecificTypePropertyAttribute.cs
- NameSpaceExtractor.cs
- ChannelSinkStacks.cs
- WindowsFormsHelpers.cs
- StateMachineAction.cs
- RectangleGeometry.cs
- User.cs
- OptimizedTemplateContent.cs
- DataSvcMapFile.cs
- MenuItemBindingCollection.cs
- SqlClientWrapperSmiStreamChars.cs
- DbProviderFactoriesConfigurationHandler.cs
- ConnectionOrientedTransportElement.cs
- DisposableCollectionWrapper.cs
- LocalizationCodeDomSerializer.cs
- Event.cs
- StatusBar.cs
- ListViewInsertEventArgs.cs
- HitTestWithPointDrawingContextWalker.cs
- ListViewSelectEventArgs.cs
- RoleService.cs
- ExternalCalls.cs
- Item.cs
- TitleStyle.cs
- SystemUnicastIPAddressInformation.cs