Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / XPathNavigatorKeyComparer.cs / 1305376 / XPathNavigatorKeyComparer.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.IO; using System.Xml.Schema; using System.Collections; using System.Diagnostics; using MS.Internal.Xml.Cache; namespace System.Xml.XPath { internal class XPathNavigatorKeyComparer : IEqualityComparer { bool IEqualityComparer.Equals( Object obj1, Object obj2 ) { XPathNavigator nav1 = obj1 as XPathNavigator; XPathNavigator nav2 = obj2 as XPathNavigator; if( ( nav1 != null ) && ( nav2 != null ) ) { if( nav1.IsSamePosition( nav2 ) ) return true; } return false; } int IEqualityComparer.GetHashCode ( Object obj ) { int hashCode; XPathNavigator nav; XPathDocumentNavigator xpdocNav; if (obj == null) { throw new ArgumentNullException("obj"); } else if ( null != (xpdocNav = obj as XPathDocumentNavigator) ) { hashCode = xpdocNav.GetPositionHashCode(); } else if( null != (nav = obj as XPathNavigator) ) { Object underlyingObject = nav.UnderlyingObject; if (underlyingObject != null) { hashCode = underlyingObject.GetHashCode(); } else { hashCode = (int)nav.NodeType; hashCode ^= nav.LocalName.GetHashCode(); hashCode ^= nav.Prefix.GetHashCode(); hashCode ^= nav.NamespaceURI.GetHashCode(); } } else { hashCode = obj.GetHashCode(); } return hashCode; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.IO; using System.Xml.Schema; using System.Collections; using System.Diagnostics; using MS.Internal.Xml.Cache; namespace System.Xml.XPath { internal class XPathNavigatorKeyComparer : IEqualityComparer { bool IEqualityComparer.Equals( Object obj1, Object obj2 ) { XPathNavigator nav1 = obj1 as XPathNavigator; XPathNavigator nav2 = obj2 as XPathNavigator; if( ( nav1 != null ) && ( nav2 != null ) ) { if( nav1.IsSamePosition( nav2 ) ) return true; } return false; } int IEqualityComparer.GetHashCode ( Object obj ) { int hashCode; XPathNavigator nav; XPathDocumentNavigator xpdocNav; if (obj == null) { throw new ArgumentNullException("obj"); } else if ( null != (xpdocNav = obj as XPathDocumentNavigator) ) { hashCode = xpdocNav.GetPositionHashCode(); } else if( null != (nav = obj as XPathNavigator) ) { Object underlyingObject = nav.UnderlyingObject; if (underlyingObject != null) { hashCode = underlyingObject.GetHashCode(); } else { hashCode = (int)nav.NodeType; hashCode ^= nav.LocalName.GetHashCode(); hashCode ^= nav.Prefix.GetHashCode(); hashCode ^= nav.NamespaceURI.GetHashCode(); } } else { hashCode = obj.GetHashCode(); } return hashCode; } } } // 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
- DataPointer.cs
- AttributeQuery.cs
- SchemaType.cs
- ValidationHelper.cs
- InboundActivityHelper.cs
- PathFigure.cs
- NameValueSectionHandler.cs
- TextView.cs
- CompilerGeneratedAttribute.cs
- AngleUtil.cs
- AsymmetricSignatureDeformatter.cs
- ProfileEventArgs.cs
- PropertyInfoSet.cs
- SettingsSavedEventArgs.cs
- MissingMemberException.cs
- EventWaitHandleSecurity.cs
- OleDbTransaction.cs
- StylusPlugin.cs
- ManagementNamedValueCollection.cs
- MSG.cs
- Publisher.cs
- PersonalizationProviderHelper.cs
- HttpHostedTransportConfiguration.cs
- MenuItemCollection.cs
- ObsoleteAttribute.cs
- XslTransform.cs
- WebPartConnectVerb.cs
- SecurityCriticalDataForSet.cs
- ContextMenuStrip.cs
- URL.cs
- ExeContext.cs
- PolyQuadraticBezierSegment.cs
- Transform3DCollection.cs
- Light.cs
- Serializer.cs
- OutOfMemoryException.cs
- TextRangeEditTables.cs
- EditingCoordinator.cs
- Delay.cs
- MediaPlayer.cs
- HttpRawResponse.cs
- CodePropertyReferenceExpression.cs
- Transform.cs
- ConfigurationManagerHelperFactory.cs
- TdsParser.cs
- ExpressionBindingsDialog.cs
- MaskInputRejectedEventArgs.cs
- RenderTargetBitmap.cs
- CheckPair.cs
- Highlights.cs
- ViewManager.cs
- ListViewHitTestInfo.cs
- MobileTemplatedControlDesigner.cs
- HierarchicalDataBoundControl.cs
- LogicalTreeHelper.cs
- cookiecontainer.cs
- XamlHttpHandlerFactory.cs
- AutomationEvent.cs
- ErrorFormatter.cs
- EmptyEnumerator.cs
- KeysConverter.cs
- StringTraceRecord.cs
- RequestBringIntoViewEventArgs.cs
- DbConvert.cs
- Geometry3D.cs
- TextTreeTextBlock.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- PolyBezierSegment.cs
- embossbitmapeffect.cs
- PanelStyle.cs
- SecurityContext.cs
- GatewayIPAddressInformationCollection.cs
- MultiBindingExpression.cs
- FileUtil.cs
- clipboard.cs
- HttpBrowserCapabilitiesWrapper.cs
- ArrayTypeMismatchException.cs
- DataGridViewAutoSizeModeEventArgs.cs
- SpecialTypeDataContract.cs
- MemberProjectedSlot.cs
- FormatterConverter.cs
- FragmentQuery.cs
- ToolBarTray.cs
- BasicCellRelation.cs
- MailWebEventProvider.cs
- WebPart.cs
- RemotingHelper.cs
- CommonDialog.cs
- TypefaceCollection.cs
- METAHEADER.cs
- ComponentManagerBroker.cs
- XmlAnyElementAttributes.cs
- DataControlFieldCollection.cs
- DocumentApplication.cs
- MetadataArtifactLoaderCompositeResource.cs
- DbConnectionPoolIdentity.cs
- ObfuscateAssemblyAttribute.cs
- CommonDialog.cs
- TaskHelper.cs
- SqlExpander.cs