Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- FixedSOMPageConstructor.cs
- RoutedEventConverter.cs
- SplitterPanelDesigner.cs
- RuntimeWrappedException.cs
- ToolStripItemClickedEventArgs.cs
- Compress.cs
- ProtocolsConfiguration.cs
- TreeNodeStyle.cs
- MobilePage.cs
- BindingOperations.cs
- DrawingVisual.cs
- EditorBrowsableAttribute.cs
- CategoryValueConverter.cs
- ColumnHeader.cs
- FieldBuilder.cs
- RtfNavigator.cs
- TransformProviderWrapper.cs
- ListDataHelper.cs
- SqlDataSourceStatusEventArgs.cs
- CssTextWriter.cs
- Label.cs
- DriveInfo.cs
- MultipleViewPatternIdentifiers.cs
- localization.cs
- TransactionFlowProperty.cs
- IfAction.cs
- LOSFormatter.cs
- NativeMethods.cs
- DataGridViewCellValidatingEventArgs.cs
- DefaultShape.cs
- CodeNamespace.cs
- BitSet.cs
- AutomationProperty.cs
- StorageEntityContainerMapping.cs
- Util.cs
- DataServiceConfiguration.cs
- WizardStepBase.cs
- EnvelopedPkcs7.cs
- XsltSettings.cs
- ByteStorage.cs
- RouteParameter.cs
- UnknownBitmapDecoder.cs
- Keywords.cs
- IgnoreFlushAndCloseStream.cs
- WinEventHandler.cs
- ColorTransformHelper.cs
- TemplatedAdorner.cs
- StringResourceManager.cs
- WebServiceErrorEvent.cs
- ResourceWriter.cs
- HGlobalSafeHandle.cs
- ImageListUtils.cs
- metadatamappinghashervisitor.cs
- GridViewPageEventArgs.cs
- OracleCommandSet.cs
- SafeFileMappingHandle.cs
- InstanceKeyCollisionException.cs
- SystemThemeKey.cs
- JsonEncodingStreamWrapper.cs
- SafeUserTokenHandle.cs
- NetPipeSectionData.cs
- UdpDiscoveryEndpointProvider.cs
- BaseAppDomainProtocolHandler.cs
- NamespaceEmitter.cs
- DesignerActionService.cs
- EdmFunction.cs
- SqlDeflator.cs
- ExpressionBinding.cs
- UpDownBase.cs
- WinOEToolBoxItem.cs
- Rect3D.cs
- FontStretchConverter.cs
- SpeakCompletedEventArgs.cs
- ObjectListComponentEditor.cs
- HttpListenerRequestUriBuilder.cs
- objectresult_tresulttype.cs
- TableRow.cs
- OutputCacheProfileCollection.cs
- IpcClientManager.cs
- InkCollectionBehavior.cs
- ReadOnlyDataSource.cs
- Converter.cs
- PowerStatus.cs
- BitmapEffectInputData.cs
- UseAttributeSetsAction.cs
- VisualBrush.cs
- PointValueSerializer.cs
- ColorDialog.cs
- TextReader.cs
- ListViewItemSelectionChangedEvent.cs
- DesignerContextDescriptor.cs
- IgnoreDeviceFilterElementCollection.cs
- SplineKeyFrames.cs
- ImageBrush.cs
- Italic.cs
- MLangCodePageEncoding.cs
- SplitterCancelEvent.cs
- ReaderWriterLockWrapper.cs
- Pair.cs
- DataExpression.cs