Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebParts / WebPartDescriptionCollection.cs / 1305376 / WebPartDescriptionCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls.WebParts { using System; using System.Collections; using System.Collections.Specialized; using System.ComponentModel; using System.Globalization; public sealed class WebPartDescriptionCollection : ReadOnlyCollectionBase { private HybridDictionary _ids; public WebPartDescriptionCollection() { } public WebPartDescriptionCollection(ICollection webPartDescriptions) { if (webPartDescriptions == null) { throw new ArgumentNullException("webPartDescriptions"); } _ids = new HybridDictionary(webPartDescriptions.Count, true /* caseInsensitive */); foreach (object obj in webPartDescriptions) { if (obj == null) { throw new ArgumentException(SR.GetString(SR.Collection_CantAddNull), "webPartDescriptions"); } WebPartDescription description = obj as WebPartDescription; if (description == null) { throw new ArgumentException(SR.GetString(SR.Collection_InvalidType, "WebPartDescription"), "webPartDescriptions"); } string id = description.ID; if (!_ids.Contains(id)) { InnerList.Add(description); _ids.Add(id, description); } else { throw new ArgumentException(SR.GetString( SR.WebPart_Collection_DuplicateID, "WebPartDescription", id), "webPartDescriptions"); } } } public bool Contains(WebPartDescription value) { return InnerList.Contains(value); } public int IndexOf(WebPartDescription value) { return InnerList.IndexOf(value); } public WebPartDescription this[int index] { get { return (WebPartDescription) InnerList[index]; } } public WebPartDescription this[string id] { get { return ((_ids != null) ? (WebPartDescription)_ids[id] : null); } } public void CopyTo(WebPartDescription[] array, int index) { InnerList.CopyTo(array, index); } } } // 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.Collections.Specialized; using System.ComponentModel; using System.Globalization; public sealed class WebPartDescriptionCollection : ReadOnlyCollectionBase { private HybridDictionary _ids; public WebPartDescriptionCollection() { } public WebPartDescriptionCollection(ICollection webPartDescriptions) { if (webPartDescriptions == null) { throw new ArgumentNullException("webPartDescriptions"); } _ids = new HybridDictionary(webPartDescriptions.Count, true /* caseInsensitive */); foreach (object obj in webPartDescriptions) { if (obj == null) { throw new ArgumentException(SR.GetString(SR.Collection_CantAddNull), "webPartDescriptions"); } WebPartDescription description = obj as WebPartDescription; if (description == null) { throw new ArgumentException(SR.GetString(SR.Collection_InvalidType, "WebPartDescription"), "webPartDescriptions"); } string id = description.ID; if (!_ids.Contains(id)) { InnerList.Add(description); _ids.Add(id, description); } else { throw new ArgumentException(SR.GetString( SR.WebPart_Collection_DuplicateID, "WebPartDescription", id), "webPartDescriptions"); } } } public bool Contains(WebPartDescription value) { return InnerList.Contains(value); } public int IndexOf(WebPartDescription value) { return InnerList.IndexOf(value); } public WebPartDescription this[int index] { get { return (WebPartDescription) InnerList[index]; } } public WebPartDescription this[string id] { get { return ((_ids != null) ? (WebPartDescription)_ids[id] : null); } } public void CopyTo(WebPartDescription[] array, int index) { InnerList.CopyTo(array, index); } } } // 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
- UserControl.cs
- CodePrimitiveExpression.cs
- BaseValidatorDesigner.cs
- ControlValuePropertyAttribute.cs
- RegularExpressionValidator.cs
- ConnectionManagementElement.cs
- UserPersonalizationStateInfo.cs
- PropertyCollection.cs
- ReadWriteSpinLock.cs
- FormatterConverter.cs
- HyperLinkField.cs
- Action.cs
- PeerCredentialElement.cs
- MultiAsyncResult.cs
- Bidi.cs
- ObjectContext.cs
- Int64AnimationUsingKeyFrames.cs
- RoutingTable.cs
- DesignerTransaction.cs
- QuotedPrintableStream.cs
- MetricEntry.cs
- FlagsAttribute.cs
- CodeDelegateInvokeExpression.cs
- RoleManagerSection.cs
- RepeaterItem.cs
- XmlSchemaGroup.cs
- FormsAuthenticationModule.cs
- InputLangChangeEvent.cs
- TextViewDesigner.cs
- AffineTransform3D.cs
- WmlTextBoxAdapter.cs
- FilterQuery.cs
- DataChangedEventManager.cs
- SqlCacheDependencyDatabase.cs
- XmlLanguage.cs
- ScrollBarAutomationPeer.cs
- TextRunProperties.cs
- SourceFileInfo.cs
- QuadTree.cs
- PropertyValidationContext.cs
- ConfigurationProperty.cs
- QilXmlWriter.cs
- ListManagerBindingsCollection.cs
- FloaterParaClient.cs
- DetailsViewUpdatedEventArgs.cs
- ReflectionTypeLoadException.cs
- DecoderReplacementFallback.cs
- MimeMapping.cs
- TextRangeSerialization.cs
- FrameworkElementAutomationPeer.cs
- OptimizedTemplateContent.cs
- Mapping.cs
- ToggleProviderWrapper.cs
- CoreSwitches.cs
- HelpInfo.cs
- ProjectionPathBuilder.cs
- WebScriptServiceHostFactory.cs
- HtmlFormWrapper.cs
- SQlBooleanStorage.cs
- SendActivity.cs
- ToolStripContainer.cs
- ProxyAttribute.cs
- ObjectSecurity.cs
- IsolatedStoragePermission.cs
- SqlDependencyListener.cs
- ChainedAsyncResult.cs
- Point.cs
- JoinGraph.cs
- TriState.cs
- DrawingAttributeSerializer.cs
- LicenseContext.cs
- WebPartTransformerCollection.cs
- FontNamesConverter.cs
- BitConverter.cs
- DoubleLinkList.cs
- HtmlSelect.cs
- NullableDoubleSumAggregationOperator.cs
- DataRecordInternal.cs
- WebBrowserSiteBase.cs
- TimeStampChecker.cs
- SortExpressionBuilder.cs
- JsonMessageEncoderFactory.cs
- WindowsFormsLinkLabel.cs
- SemanticBasicElement.cs
- UserControlCodeDomTreeGenerator.cs
- LZCodec.cs
- CrossAppDomainChannel.cs
- DataServiceRequestOfT.cs
- TransportSecurityHelpers.cs
- FloatUtil.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- HorizontalAlignConverter.cs
- ConfigUtil.cs
- MembershipPasswordException.cs
- DefaultTraceListener.cs
- ListViewTableCell.cs
- StrokeCollectionConverter.cs
- Vector3D.cs
- TypeDescriptorFilterService.cs
- WebPartChrome.cs