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
- HttpWebRequest.cs
- OverlappedAsyncResult.cs
- SecurityCriticalDataForSet.cs
- Peer.cs
- _IPv4Address.cs
- WindowsEditBox.cs
- HttpModuleActionCollection.cs
- SmtpNtlmAuthenticationModule.cs
- TableLayoutSettingsTypeConverter.cs
- MultiSelectRootGridEntry.cs
- CacheOutputQuery.cs
- Mappings.cs
- SafeCryptoHandles.cs
- BackgroundFormatInfo.cs
- DataMemberConverter.cs
- ParserStack.cs
- SettingsPropertyCollection.cs
- Query.cs
- EtwProvider.cs
- Stacktrace.cs
- SystemEvents.cs
- SQLMembershipProvider.cs
- ZipIOExtraFieldPaddingElement.cs
- XmlSchemaGroupRef.cs
- AnnotationElement.cs
- DependencyPropertyDescriptor.cs
- DataGridParentRows.cs
- ResourceDescriptionAttribute.cs
- WpfGeneratedKnownTypes.cs
- SessionEndingEventArgs.cs
- Typeface.cs
- HtmlInputReset.cs
- ShapingEngine.cs
- CopyAttributesAction.cs
- DetailsViewDeleteEventArgs.cs
- UserUseLicenseDictionaryLoader.cs
- ReflectPropertyDescriptor.cs
- HTTPRemotingHandler.cs
- InvokeMethodDesigner.xaml.cs
- PlatformNotSupportedException.cs
- RowTypeElement.cs
- SplitContainer.cs
- FunctionQuery.cs
- PropertyIdentifier.cs
- ActiveDocumentEvent.cs
- EnumMemberAttribute.cs
- ThreadStartException.cs
- SerializationSectionGroup.cs
- CroppedBitmap.cs
- OverflowException.cs
- PseudoWebRequest.cs
- RegionInfo.cs
- TreeSet.cs
- BlurBitmapEffect.cs
- XmlBindingWorker.cs
- _Connection.cs
- ImmutableObjectAttribute.cs
- PrintingPermission.cs
- DataGridViewCell.cs
- ConfigurationFileMap.cs
- ExpressionQuoter.cs
- ListBoxItemAutomationPeer.cs
- CompilerScopeManager.cs
- Int64Converter.cs
- StandardMenuStripVerb.cs
- SchemaComplexType.cs
- AsynchronousChannelMergeEnumerator.cs
- SignedXml.cs
- EntityDataSourceChangingEventArgs.cs
- ClientTargetCollection.cs
- X509Utils.cs
- DataTrigger.cs
- ContractMapping.cs
- precedingsibling.cs
- InheritedPropertyChangedEventArgs.cs
- TableItemPatternIdentifiers.cs
- KernelTypeValidation.cs
- DataGridViewAutoSizeModeEventArgs.cs
- WhitespaceRuleReader.cs
- InertiaRotationBehavior.cs
- VBCodeProvider.cs
- IUnknownConstantAttribute.cs
- _DomainName.cs
- PersistenceTypeAttribute.cs
- PreviousTrackingServiceAttribute.cs
- NativeMethods.cs
- TextReader.cs
- ListBindingHelper.cs
- SqlClientFactory.cs
- XsdBuildProvider.cs
- SkipQueryOptionExpression.cs
- XamlPointCollectionSerializer.cs
- DataSourceControl.cs
- AesCryptoServiceProvider.cs
- Profiler.cs
- XPathDocumentBuilder.cs
- UserPreferenceChangingEventArgs.cs
- Types.cs
- processwaithandle.cs
- DataGridViewToolTip.cs