Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / BindingElementCollection.cs / 1 / BindingElementCollection.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Channels { using System.ServiceModel; using System.ComponentModel; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime.Serialization; public class BindingElementCollection : Collection{ public BindingElementCollection() { } public BindingElementCollection(IEnumerable elements) { if (elements == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("elements"); foreach (BindingElement element in elements) { base.Add(element); } } public BindingElementCollection(BindingElement[] elements) { if (elements == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("elements"); for (int i = 0; i < elements.Length; i++) { base.Add(elements[i]); } } internal BindingElementCollection(BindingElementCollection elements) { if (elements == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("elements"); for (int i = 0; i < elements.Count; i++) { base.Add(elements[i]); } } // returns a new collection with clones of all the elements public BindingElementCollection Clone() { BindingElementCollection result = new BindingElementCollection(); for (int i = 0; i < this.Count; i++) { result.Add(this[i].Clone()); } return result; } public void AddRange(params BindingElement[] elements) { if (elements == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("elements"); for (int i = 0; i < elements.Length; i++) { base.Add(elements[i]); } } public bool Contains(Type bindingElementType) { if (bindingElementType == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElementType"); for (int i = 0; i < this.Count; i++) { if (bindingElementType.IsInstanceOfType(this[i])) return true; } return false; } public T Find () { return Find (false); } public T Remove () { return Find (true); } T Find (bool remove) { for (int index = 0; index < this.Count; index++) { if (this[index] is T) { T item = (T)(object)this[index]; if (remove) { RemoveAt(index); } return item; } } return default(T); } public Collection FindAll () { return FindAll (false); } public Collection RemoveAll () { return FindAll (true); } Collection FindAll (bool remove) { Collection collection = new Collection (); for (int index = 0; index < this.Count; index++) { if (this[index] is T) { T item = (T)(object)this[index]; if (remove) { RemoveAt(index); // back up the index so we inspect the new item at this location index--; } collection.Add(item); } } return collection; } protected override void InsertItem(int index, BindingElement item) { if (item == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("item"); base.InsertItem(index, item); } protected override void SetItem(int index, BindingElement item) { if (item == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("item"); base.SetItem(index, item); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TabControlCancelEvent.cs
- DetailsViewPagerRow.cs
- AsymmetricKeyExchangeDeformatter.cs
- UriScheme.cs
- BookmarkInfo.cs
- HtmlMeta.cs
- PriorityBinding.cs
- EventPrivateKey.cs
- PerspectiveCamera.cs
- ColorConvertedBitmapExtension.cs
- PermissionSet.cs
- CombinedHttpChannel.cs
- UnionCodeGroup.cs
- StructuredProperty.cs
- BitmapEffectInputData.cs
- ChildChangedEventArgs.cs
- AsyncMethodInvoker.cs
- BindingNavigator.cs
- StylusPointCollection.cs
- EndpointPerformanceCounters.cs
- KeyboardNavigation.cs
- SemanticValue.cs
- Transform3DGroup.cs
- Point3D.cs
- XmlMapping.cs
- ViewKeyConstraint.cs
- GenericIdentity.cs
- DirtyTextRange.cs
- TextAdaptor.cs
- LocalizationCodeDomSerializer.cs
- BuildResult.cs
- _SecureChannel.cs
- AddressHeaderCollectionElement.cs
- ValidatingPropertiesEventArgs.cs
- Int32KeyFrameCollection.cs
- DataGridViewImageColumn.cs
- FixedSOMLineRanges.cs
- DockPanel.cs
- SmtpLoginAuthenticationModule.cs
- EntitySetDataBindingList.cs
- KeyConstraint.cs
- JsonSerializer.cs
- SchemaTableColumn.cs
- SQLInt16Storage.cs
- EventRouteFactory.cs
- ApplicationContext.cs
- BitVec.cs
- DropShadowEffect.cs
- SuppressMessageAttribute.cs
- OdbcException.cs
- UnknownWrapper.cs
- CompensationHandlingFilter.cs
- Simplifier.cs
- RangeValidator.cs
- ToolStripContainer.cs
- XmlSchemaType.cs
- SqlServices.cs
- RedistVersionInfo.cs
- EmissiveMaterial.cs
- _FtpDataStream.cs
- SamlAudienceRestrictionCondition.cs
- EndGetFileNameFromUserRequest.cs
- DataList.cs
- SubclassTypeValidatorAttribute.cs
- ConnectionInterfaceCollection.cs
- SqlClientFactory.cs
- ParameterInfo.cs
- namescope.cs
- MultipleViewProviderWrapper.cs
- OptimizerPatterns.cs
- XPathArrayIterator.cs
- EntityDataSourceContainerNameItem.cs
- HwndSource.cs
- MemoryMappedViewStream.cs
- PackagingUtilities.cs
- SqlNode.cs
- ToolStripDropTargetManager.cs
- CatalogZone.cs
- PasswordBox.cs
- ContentFileHelper.cs
- DataTableClearEvent.cs
- ISAPIRuntime.cs
- RadioButtonPopupAdapter.cs
- FilterQueryOptionExpression.cs
- Enum.cs
- ReturnValue.cs
- DataTransferEventArgs.cs
- HandlerFactoryCache.cs
- FixedStringLookup.cs
- DockingAttribute.cs
- indexingfiltermarshaler.cs
- DbSetClause.cs
- XmlCodeExporter.cs
- ToolStripRenderer.cs
- DataGridColumnCollectionEditor.cs
- SqlFileStream.cs
- Matrix3DConverter.cs
- TextServicesPropertyRanges.cs
- DataBoundControlAdapter.cs
- ThousandthOfEmRealPoints.cs