Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Xml / System / Xml / XPath / XPathNavigatorKeyComparer.cs / 1 / 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
- SchemaLookupTable.cs
- DataGridColumn.cs
- AutoScrollHelper.cs
- XPathNodePointer.cs
- WeakReferenceEnumerator.cs
- AutomationEventArgs.cs
- CodeCompiler.cs
- FileReservationCollection.cs
- ApplicationTrust.cs
- TaiwanCalendar.cs
- ResourceCategoryAttribute.cs
- InternalControlCollection.cs
- SerializationTrace.cs
- NegotiateStream.cs
- Relationship.cs
- DataGridTextBox.cs
- StorageEndPropertyMapping.cs
- KnownTypesHelper.cs
- UrlUtility.cs
- URI.cs
- PartialTrustHelpers.cs
- InkPresenterAutomationPeer.cs
- TraceEventCache.cs
- SoapUnknownHeader.cs
- BasicViewGenerator.cs
- UdpTransportSettings.cs
- SamlAuthorizationDecisionStatement.cs
- WebBrowsableAttribute.cs
- DynamicPhysicalDiscoSearcher.cs
- LockCookie.cs
- PolicyManager.cs
- ImageSource.cs
- TaskDesigner.cs
- MergeFilterQuery.cs
- FactoryGenerator.cs
- ProgressPage.cs
- XmlRawWriter.cs
- CompositionDesigner.cs
- Composition.cs
- StandardOleMarshalObject.cs
- LinkClickEvent.cs
- FormViewUpdateEventArgs.cs
- EqualityComparer.cs
- IndexedWhereQueryOperator.cs
- XmlTextAttribute.cs
- OleDbConnectionInternal.cs
- arc.cs
- SmtpCommands.cs
- COMException.cs
- StateMachineSubscriptionManager.cs
- ByteStack.cs
- ConfigurationConverterBase.cs
- Transform3DGroup.cs
- RtType.cs
- MaxValueConverter.cs
- RouteValueExpressionBuilder.cs
- Statements.cs
- GroupBoxAutomationPeer.cs
- DataListItem.cs
- DataServices.cs
- StringValueSerializer.cs
- DataGridViewColumnEventArgs.cs
- TextServicesHost.cs
- WebPartConnection.cs
- PropertyConverter.cs
- XmlDataContract.cs
- MaterializeFromAtom.cs
- ViewEvent.cs
- UIElementIsland.cs
- _NegoState.cs
- RectAnimation.cs
- FixedHighlight.cs
- StringOutput.cs
- DataColumnChangeEvent.cs
- VerificationAttribute.cs
- SpinLock.cs
- ParserHooks.cs
- CheckBoxList.cs
- StrongNamePublicKeyBlob.cs
- XPathChildIterator.cs
- OracleRowUpdatingEventArgs.cs
- securitycriticaldataformultiplegetandset.cs
- ImageList.cs
- PrintPreviewGraphics.cs
- WaitingCursor.cs
- DefaultHttpHandler.cs
- _NestedMultipleAsyncResult.cs
- KnownTypeHelper.cs
- AxHost.cs
- StringFunctions.cs
- DataSourceSelectArguments.cs
- RC2CryptoServiceProvider.cs
- DataGridViewCellValueEventArgs.cs
- Region.cs
- ManagementBaseObject.cs
- XamlRtfConverter.cs
- TypeBrowserDialog.cs
- Int32.cs
- EnumerableValidator.cs
- FileInfo.cs