Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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);
}
}
}
}
}
// 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;
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);
}
}
}
}
}
// 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
- AssemblyAttributesGoHere.cs
- Matrix3DStack.cs
- SQLBoolean.cs
- FastPropertyAccessor.cs
- NumericExpr.cs
- ToolStripAdornerWindowService.cs
- UIAgentCrashedException.cs
- DataGridViewCellStyleChangedEventArgs.cs
- DescendantOverDescendantQuery.cs
- MemoryMappedFile.cs
- MediaPlayerState.cs
- AddressHeader.cs
- ReferencedType.cs
- QilTypeChecker.cs
- TreeViewEvent.cs
- FactoryGenerator.cs
- BoundsDrawingContextWalker.cs
- RoutedCommand.cs
- ContextInformation.cs
- AutomationPatternInfo.cs
- CompositeFontParser.cs
- DataError.cs
- SimpleBitVector32.cs
- Permission.cs
- RequestCachingSection.cs
- FocusTracker.cs
- WindowsRichEdit.cs
- StructuredProperty.cs
- BitmapEffectDrawing.cs
- TransactionScope.cs
- RegularExpressionValidator.cs
- OdbcDataReader.cs
- Accessors.cs
- MaskDesignerDialog.cs
- HtmlTableCellCollection.cs
- SelectionUIService.cs
- FixedDSBuilder.cs
- DataGridViewComboBoxEditingControl.cs
- DataAdapter.cs
- XmlWriterDelegator.cs
- ThreadAttributes.cs
- AutomationPatternInfo.cs
- DateTimeUtil.cs
- OleDbParameter.cs
- MimeObjectFactory.cs
- BitSet.cs
- ObjectViewListener.cs
- HttpDictionary.cs
- VBCodeProvider.cs
- IgnoreSectionHandler.cs
- PathParser.cs
- SplineKeyFrames.cs
- ThemeableAttribute.cs
- UnsafeNativeMethods.cs
- ToolStripSplitButton.cs
- ThreadStateException.cs
- ResolvedKeyFrameEntry.cs
- TreeIterator.cs
- ComponentSerializationService.cs
- MergePropertyDescriptor.cs
- SqlBooleanMismatchVisitor.cs
- WpfXamlType.cs
- XmlSignatureManifest.cs
- ControlBindingsCollection.cs
- AudioFormatConverter.cs
- SchemaManager.cs
- Transform.cs
- PenThread.cs
- Stacktrace.cs
- WebPartMenu.cs
- BaseResourcesBuildProvider.cs
- ActivityBindForm.Designer.cs
- ConstraintManager.cs
- StubHelpers.cs
- MutexSecurity.cs
- SqlExpander.cs
- HtmlInputHidden.cs
- MSAAEventDispatcher.cs
- OleDbInfoMessageEvent.cs
- Decorator.cs
- FollowerQueueCreator.cs
- __ConsoleStream.cs
- WindowsListViewItemStartMenu.cs
- IERequestCache.cs
- DataControlImageButton.cs
- EmptyImpersonationContext.cs
- QueryRewriter.cs
- TdsEnums.cs
- Util.cs
- DisplayInformation.cs
- RTLAwareMessageBox.cs
- ComplexBindingPropertiesAttribute.cs
- ReflectTypeDescriptionProvider.cs
- QilGenerator.cs
- Crc32Helper.cs
- Compiler.cs
- Graph.cs
- FormsAuthenticationEventArgs.cs
- SqlSupersetValidator.cs
- EntityDataSourceWrapperCollection.cs