Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- StringValidator.cs
- ClientRuntimeConfig.cs
- BinaryQueryOperator.cs
- ObservableCollection.cs
- CodeTypeDelegate.cs
- GlobalizationAssembly.cs
- SizeFConverter.cs
- EndPoint.cs
- TerminatorSinks.cs
- MsmqHostedTransportManager.cs
- EventBuilder.cs
- DataGridViewCellStyleChangedEventArgs.cs
- WindowsScroll.cs
- PersistenceTypeAttribute.cs
- HTTPRemotingHandler.cs
- QueueAccessMode.cs
- ConfigWriter.cs
- HiddenFieldPageStatePersister.cs
- ToolStripSettings.cs
- AdapterDictionary.cs
- Separator.cs
- XmlArrayItemAttribute.cs
- Sql8ExpressionRewriter.cs
- MessageEventSubscriptionService.cs
- XmlWrappingReader.cs
- SharedDp.cs
- EncoderParameter.cs
- CodeVariableReferenceExpression.cs
- ImageUrlEditor.cs
- KeyBinding.cs
- TrustManager.cs
- SqlDataReaderSmi.cs
- XsltLibrary.cs
- Main.cs
- CodeFieldReferenceExpression.cs
- FillRuleValidation.cs
- OdbcError.cs
- DataGridViewTextBoxCell.cs
- TextFindEngine.cs
- InvalidAsynchronousStateException.cs
- StateWorkerRequest.cs
- GraphicsContainer.cs
- DelimitedListTraceListener.cs
- ComplexPropertyEntry.cs
- ProtocolsConfigurationHandler.cs
- ToolboxCategoryItems.cs
- WebPartZone.cs
- SecurityContextSecurityTokenParameters.cs
- SystemIcmpV6Statistics.cs
- ViewCellSlot.cs
- TrackingProfile.cs
- LifetimeMonitor.cs
- HttpPostServerProtocol.cs
- FixedHighlight.cs
- SpellerStatusTable.cs
- FormCollection.cs
- ValidationRule.cs
- Latin1Encoding.cs
- FeatureSupport.cs
- SmiSettersStream.cs
- XmlRawWriter.cs
- ConnectionConsumerAttribute.cs
- BitmapEffectCollection.cs
- DbParameterCollectionHelper.cs
- WebResourceAttribute.cs
- BindToObject.cs
- Calendar.cs
- SingleObjectCollection.cs
- FormViewCommandEventArgs.cs
- KeyValuePair.cs
- WebPartCatalogAddVerb.cs
- DiagnosticsElement.cs
- RevocationPoint.cs
- PointLightBase.cs
- GridViewUpdatedEventArgs.cs
- DataControlButton.cs
- ControlHelper.cs
- ReadWriteControlDesigner.cs
- DefaultIfEmptyQueryOperator.cs
- RelationshipDetailsCollection.cs
- SafeHandles.cs
- RijndaelCryptoServiceProvider.cs
- HttpListenerContext.cs
- BitmapPalette.cs
- CounterCreationData.cs
- COM2Properties.cs
- HelpFileFileNameEditor.cs
- ContextProperty.cs
- MinMaxParagraphWidth.cs
- XmlReader.cs
- FormsIdentity.cs
- TextEditorTables.cs
- SimpleBitVector32.cs
- SiteMapNodeCollection.cs
- MSAAEventDispatcher.cs
- AdCreatedEventArgs.cs
- RegexRunnerFactory.cs
- XmlBindingWorker.cs
- jithelpers.cs
- JulianCalendar.cs