Code:
/ FX-1434 / FX-1434 / 1.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
- CharUnicodeInfo.cs
- SiblingIterators.cs
- SqlDataReaderSmi.cs
- DurationConverter.cs
- ObjectNotFoundException.cs
- XmlTypeAttribute.cs
- Scene3D.cs
- ValidationResult.cs
- TypeInfo.cs
- RootBrowserWindowProxy.cs
- HTMLTextWriter.cs
- XmlNodeChangedEventManager.cs
- Exceptions.cs
- PermissionSetTriple.cs
- PrintControllerWithStatusDialog.cs
- FormsAuthentication.cs
- CodeTypeReferenceSerializer.cs
- BufferBuilder.cs
- XmlSchemaExporter.cs
- SoapElementAttribute.cs
- InstanceBehavior.cs
- CaseInsensitiveHashCodeProvider.cs
- AsymmetricKeyExchangeDeformatter.cs
- OracleString.cs
- GcSettings.cs
- BorderGapMaskConverter.cs
- GlyphingCache.cs
- messageonlyhwndwrapper.cs
- XmlQueryRuntime.cs
- DynamicQueryableWrapper.cs
- SecurityTokenTypes.cs
- ProviderSettingsCollection.cs
- Nodes.cs
- _Semaphore.cs
- HyperLinkStyle.cs
- XmlElement.cs
- ExpandCollapseIsCheckedConverter.cs
- RSATokenProvider.cs
- ServiceBuildProvider.cs
- documentation.cs
- NoClickablePointException.cs
- FocusTracker.cs
- ButtonColumn.cs
- MutexSecurity.cs
- FlowDocumentFormatter.cs
- SessionStateUtil.cs
- EmbeddedObject.cs
- ScaleTransform3D.cs
- SerializationAttributes.cs
- ObjectIDGenerator.cs
- COM2ExtendedTypeConverter.cs
- InkPresenterAutomationPeer.cs
- ThemeDictionaryExtension.cs
- EntityFrameworkVersions.cs
- PropertyFilterAttribute.cs
- DSACryptoServiceProvider.cs
- MultiTrigger.cs
- ZoneButton.cs
- ZipIOBlockManager.cs
- GroupPartitionExpr.cs
- SqlParameter.cs
- ListDataHelper.cs
- HwndSourceParameters.cs
- HtmlTextArea.cs
- RoleService.cs
- CancelEventArgs.cs
- ConstructorNeedsTagAttribute.cs
- X509ThumbprintKeyIdentifierClause.cs
- TrustManagerPromptUI.cs
- GroupBox.cs
- WorkingDirectoryEditor.cs
- XmlWriterDelegator.cs
- HtmlProps.cs
- LinqDataView.cs
- ValueUnavailableException.cs
- WebPartMenu.cs
- GridLength.cs
- DPTypeDescriptorContext.cs
- Renderer.cs
- exports.cs
- CompiledQueryCacheKey.cs
- LocalTransaction.cs
- ProfileManager.cs
- AutomationAttributeInfo.cs
- WS2007HttpBindingElement.cs
- DataGridSortingEventArgs.cs
- SqlUDTStorage.cs
- HtmlContainerControl.cs
- SystemIPAddressInformation.cs
- FacetChecker.cs
- ApplyTemplatesAction.cs
- SQLSingle.cs
- _ShellExpression.cs
- DocumentOrderComparer.cs
- XPathDocument.cs
- InertiaTranslationBehavior.cs
- DataTableExtensions.cs
- EntityTransaction.cs
- _ListenerResponseStream.cs
- RuleSetReference.cs