Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Description / PolicyAssertionCollection.cs / 1 / PolicyAssertionCollection.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Description { using System.ServiceModel; using System.ComponentModel; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime.Serialization; using System.Xml; public class PolicyAssertionCollection : Collection{ public PolicyAssertionCollection() { } public PolicyAssertionCollection(IEnumerable elements) { if (elements == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("elements"); AddRange(elements); } internal void AddRange(IEnumerable elements) { foreach (XmlElement element in elements) { base.Add(element); } } public bool Contains(string localName, string namespaceUri) { if (localName == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("localName"); if (namespaceUri == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("namespaceUri"); for (int i = 0; i < this.Count; i++) { XmlElement item = this[i]; if (item.LocalName == localName && item.NamespaceURI == namespaceUri) return true; } return false; } public XmlElement Find(string localName, string namespaceUri) { return Find(localName, namespaceUri, false); } public XmlElement Remove(string localName, string namespaceUri) { return Find(localName, namespaceUri, true); } XmlElement Find(string localName, string namespaceUri, bool remove) { if (localName == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("localName"); if (namespaceUri == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("namespaceUri"); for (int index = 0; index < this.Count; index++) { XmlElement item = this[index]; if (item.LocalName == localName && item.NamespaceURI == namespaceUri) { if (remove) { RemoveAt(index); } return item; } } return null; } public Collection FindAll(string localName, string namespaceUri) { return FindAll(localName, namespaceUri, false); } public Collection RemoveAll(string localName, string namespaceUri) { return FindAll(localName, namespaceUri, true); } Collection FindAll(string localName, string namespaceUri, bool remove) { if (localName == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("localName"); if (namespaceUri == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("namespaceUri"); Collection collection = new Collection (); for (int index = 0; index < this.Count; index++) { XmlElement item = this[index]; if (item.LocalName == localName && item.NamespaceURI == namespaceUri) { 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, XmlElement item) { if (item == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("item"); base.InsertItem(index, item); } protected override void SetItem(int index, XmlElement 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
- WindowsFont.cs
- _SSPIWrapper.cs
- SecurityTokenResolver.cs
- validationstate.cs
- APCustomTypeDescriptor.cs
- FormsAuthenticationModule.cs
- SelectionUIHandler.cs
- FrameSecurityDescriptor.cs
- storagemappingitemcollection.viewdictionary.cs
- ListBindingHelper.cs
- Empty.cs
- Serializer.cs
- TrustLevel.cs
- FollowerQueueCreator.cs
- DesignerDataSourceView.cs
- FeatureSupport.cs
- ChangePasswordAutoFormat.cs
- GridViewPageEventArgs.cs
- PieceNameHelper.cs
- Boolean.cs
- BaseInfoTable.cs
- DurableInstanceContextProvider.cs
- XmlNodeComparer.cs
- DataGridState.cs
- RawStylusInputCustomData.cs
- SvcMapFileSerializer.cs
- CopyCodeAction.cs
- Visual3D.cs
- PlacementWorkspace.cs
- SqlPersistenceProviderFactory.cs
- Brush.cs
- PolicyManager.cs
- Matrix3D.cs
- XmlWhitespace.cs
- ListView.cs
- ByteAnimationUsingKeyFrames.cs
- SystemIPv4InterfaceProperties.cs
- RuntimeConfigLKG.cs
- GraphicsContext.cs
- StructuredProperty.cs
- CacheOutputQuery.cs
- ServerValidateEventArgs.cs
- SignatureDescription.cs
- WebPartDisplayModeCollection.cs
- NegotiateStream.cs
- UpdatePanelControlTrigger.cs
- PointLightBase.cs
- PartialCachingControl.cs
- HeaderedContentControl.cs
- XmlBinaryReader.cs
- ExpandSegment.cs
- Model3DCollection.cs
- XamlSerializationHelper.cs
- SafeUserTokenHandle.cs
- XmlWellformedWriterHelpers.cs
- ProxyHelper.cs
- KnownIds.cs
- PaperSource.cs
- Win32Exception.cs
- TransportConfigurationTypeElementCollection.cs
- EventHandlerList.cs
- ObjectQueryState.cs
- BufferedReadStream.cs
- WebServiceErrorEvent.cs
- ComponentCommands.cs
- HtmlTableCellCollection.cs
- X509SubjectKeyIdentifierClause.cs
- Adorner.cs
- ContextBase.cs
- CryptoStream.cs
- ObjectStateManager.cs
- ValueHandle.cs
- PageAsyncTaskManager.cs
- JoinQueryOperator.cs
- DesignerCategoryAttribute.cs
- DuplicateWaitObjectException.cs
- Rotation3DAnimationBase.cs
- ValidationSummaryDesigner.cs
- SecurityUtils.cs
- XmlUtil.cs
- InvariantComparer.cs
- SessionStateUtil.cs
- MouseGestureValueSerializer.cs
- InternalsVisibleToAttribute.cs
- CornerRadius.cs
- _ProxyChain.cs
- ConfigXmlCDataSection.cs
- SmiContext.cs
- InternalEnumValidator.cs
- EntitySetDataBindingList.cs
- TemplateControlParser.cs
- GenericPrincipal.cs
- SpecularMaterial.cs
- PropertyValidationContext.cs
- CommandValueSerializer.cs
- EntityCodeGenerator.cs
- SqlConnectionPoolGroupProviderInfo.cs
- OracleLob.cs
- EntityExpressionVisitor.cs
- ListBindingHelper.cs