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
- EtwTrackingParticipant.cs
- DesignerCalendarAdapter.cs
- Panel.cs
- DateTimeParse.cs
- DurableOperationContext.cs
- InstanceDescriptor.cs
- MenuItemAutomationPeer.cs
- RemotingSurrogateSelector.cs
- __ComObject.cs
- SettingsBase.cs
- WorkflowQueue.cs
- ToolStripItem.cs
- DrawingCollection.cs
- GroupBox.cs
- ModelFactory.cs
- SchemaDeclBase.cs
- DesignerForm.cs
- CopyCodeAction.cs
- HostedElements.cs
- EventLogConfiguration.cs
- ResourceDisplayNameAttribute.cs
- DirectionalLight.cs
- EntityDesignerUtils.cs
- ExpressionBuilder.cs
- UInt32Converter.cs
- Trace.cs
- EventProperty.cs
- CollectionBase.cs
- Parameter.cs
- OrderPreservingPipeliningMergeHelper.cs
- KnownColorTable.cs
- IteratorFilter.cs
- XD.cs
- SharingService.cs
- SimplePropertyEntry.cs
- SqlClientPermission.cs
- PackageRelationshipSelector.cs
- Stroke.cs
- AlignmentXValidation.cs
- HtmlInputImage.cs
- ResourceDescriptionAttribute.cs
- ColorTransformHelper.cs
- InstanceKeyView.cs
- Fault.cs
- NaturalLanguageHyphenator.cs
- OracleDateTime.cs
- EventArgs.cs
- XsltLoader.cs
- StatusBarItem.cs
- Process.cs
- CharEntityEncoderFallback.cs
- MessagingActivityHelper.cs
- AdornedElementPlaceholder.cs
- SqlClientMetaDataCollectionNames.cs
- GridViewEditEventArgs.cs
- SerializationAttributes.cs
- SchemaMapping.cs
- XamlTypeMapper.cs
- ProfileGroupSettingsCollection.cs
- DataGridViewRowConverter.cs
- SpanIndex.cs
- DbgUtil.cs
- ListControl.cs
- StringSorter.cs
- UpDownEvent.cs
- HyperlinkAutomationPeer.cs
- GrammarBuilderWildcard.cs
- SrgsText.cs
- XmlNavigatorStack.cs
- KeyManager.cs
- HttpFileCollection.cs
- WebServiceClientProxyGenerator.cs
- DaylightTime.cs
- TileModeValidation.cs
- RuntimeWrappedException.cs
- RectangleHotSpot.cs
- JavaScriptSerializer.cs
- SqlGenerator.cs
- AssemblyResourceLoader.cs
- MeshGeometry3D.cs
- TemplateField.cs
- SafeSecurityHandles.cs
- MappableObjectManager.cs
- ListenerElementsCollection.cs
- OleDbFactory.cs
- Vector3DCollectionConverter.cs
- UnSafeCharBuffer.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- KeyToListMap.cs
- BrowserDefinition.cs
- XmlSerializerSection.cs
- ChooseAction.cs
- HtmlLinkAdapter.cs
- PrtCap_Public_Simple.cs
- EllipseGeometry.cs
- BlurEffect.cs
- OuterGlowBitmapEffect.cs
- AxisAngleRotation3D.cs
- columnmapkeybuilder.cs
- CryptoSession.cs