Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / WebParts / CatalogPartCollection.cs / 2 / 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 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. //------------------------------------------------------------------------------ //// 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 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EmptyReadOnlyDictionaryInternal.cs
- Registry.cs
- GenericAuthenticationEventArgs.cs
- XmlSchemaRedefine.cs
- RectangleF.cs
- BypassElement.cs
- DomainUpDown.cs
- BitStream.cs
- PropertySourceInfo.cs
- SmiEventSink.cs
- WebPartConnectionsDisconnectVerb.cs
- NameValueCollection.cs
- DataProtection.cs
- PathSegment.cs
- ModuleBuilder.cs
- WindowInteractionStateTracker.cs
- FormViewUpdateEventArgs.cs
- HostedTransportConfigurationBase.cs
- SchemaAttDef.cs
- ToolStripItemRenderEventArgs.cs
- EntityFunctions.cs
- HttpHandlerActionCollection.cs
- SignatureResourcePool.cs
- ExpressionVisitorHelpers.cs
- GeneralTransform3DTo2DTo3D.cs
- DynamicScriptObject.cs
- MissingManifestResourceException.cs
- Crc32Helper.cs
- StreamInfo.cs
- Internal.cs
- PeerEndPoint.cs
- PackagingUtilities.cs
- CatalogPartChrome.cs
- GridLength.cs
- UnsafeMethods.cs
- TableRow.cs
- GraphicsContext.cs
- StyleHelper.cs
- XMLUtil.cs
- WebEncodingValidatorAttribute.cs
- PointAnimationClockResource.cs
- BaseComponentEditor.cs
- infer.cs
- WaitForChangedResult.cs
- Wizard.cs
- ResolveResponse.cs
- ValidationErrorEventArgs.cs
- Propagator.cs
- DataTableMappingCollection.cs
- ContainerAction.cs
- _Events.cs
- AttachmentService.cs
- AddInServer.cs
- WebDisplayNameAttribute.cs
- WebServiceErrorEvent.cs
- AddInServer.cs
- RoutedEventConverter.cs
- CompilerScopeManager.cs
- ReferenceSchema.cs
- IRCollection.cs
- dbdatarecord.cs
- LineServicesRun.cs
- DocumentViewerBaseAutomationPeer.cs
- ListViewItem.cs
- XsdCachingReader.cs
- NextPreviousPagerField.cs
- TrustLevel.cs
- EditorZone.cs
- SR.cs
- XmlBaseWriter.cs
- HttpCachePolicy.cs
- DrawingContextDrawingContextWalker.cs
- precedingquery.cs
- XmlElement.cs
- CodeTryCatchFinallyStatement.cs
- SqlConnectionHelper.cs
- WindowsListViewScroll.cs
- SqlDuplicator.cs
- SelectionEditor.cs
- XmlNamespaceDeclarationsAttribute.cs
- InfoCardProofToken.cs
- ContainerFilterService.cs
- SwitchAttribute.cs
- Pair.cs
- TypeElement.cs
- WebReferenceOptions.cs
- AppDomainFactory.cs
- DesignerMetadata.cs
- ConcurrentStack.cs
- Win32SafeHandles.cs
- DataPagerFieldCommandEventArgs.cs
- HierarchicalDataSourceIDConverter.cs
- ReferenceConverter.cs
- ReturnEventArgs.cs
- userdatakeys.cs
- UIInitializationException.cs
- DupHandleConnectionReader.cs
- Trustee.cs
- StringOutput.cs
- BamlRecordWriter.cs