Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- DataServiceHost.cs
- CodeStatementCollection.cs
- TrackBarRenderer.cs
- DataErrorValidationRule.cs
- OleDbConnection.cs
- FactoryId.cs
- ObjectItemAttributeAssemblyLoader.cs
- InputBinding.cs
- BufferedGraphics.cs
- SchemaDeclBase.cs
- StylusPointProperty.cs
- AssemblyLoader.cs
- wgx_sdk_version.cs
- ResetableIterator.cs
- TransactedBatchingElement.cs
- Row.cs
- DataGridViewAutoSizeModeEventArgs.cs
- LogicalTreeHelper.cs
- PageStatePersister.cs
- DataGridHelper.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- ShaderEffect.cs
- ServiceReference.cs
- SurrogateEncoder.cs
- PolyQuadraticBezierSegment.cs
- PermissionSet.cs
- Pair.cs
- CodeSubDirectory.cs
- RowCache.cs
- Native.cs
- SystemWebSectionGroup.cs
- IISUnsafeMethods.cs
- InvalidCastException.cs
- PathParser.cs
- XamlDesignerSerializationManager.cs
- ListViewSelectEventArgs.cs
- XhtmlConformanceSection.cs
- SchemaImporterExtensionsSection.cs
- MatrixAnimationUsingPath.cs
- SmiEventSink_Default.cs
- ImageList.cs
- WaveHeader.cs
- mediapermission.cs
- ShapingWorkspace.cs
- BitmapEffectrendercontext.cs
- IIS7UserPrincipal.cs
- MessageQueueKey.cs
- DefaultPropertyAttribute.cs
- DtdParser.cs
- CounterCreationDataCollection.cs
- TextRunCache.cs
- XslTransform.cs
- BulletedListEventArgs.cs
- CellPartitioner.cs
- HtmlInputReset.cs
- WpfKnownTypeInvoker.cs
- WebPartConnectionsCancelVerb.cs
- SessionStateSection.cs
- TableLayoutStyleCollection.cs
- ScopelessEnumAttribute.cs
- Normalizer.cs
- ParameterEditorUserControl.cs
- CompilerCollection.cs
- OdbcConnectionOpen.cs
- FormattedText.cs
- CryptoHelper.cs
- _NestedMultipleAsyncResult.cs
- ping.cs
- WebPartConnectionsConnectVerb.cs
- TextBox.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- CssTextWriter.cs
- Grant.cs
- LocatorPartList.cs
- ColorTranslator.cs
- ServiceDescriptionImporter.cs
- BufferedMessageData.cs
- SchemaImporterExtensionElement.cs
- UDPClient.cs
- SoapTypeAttribute.cs
- LexicalChunk.cs
- CompiledWorkflowDefinitionContext.cs
- ConfigurationManager.cs
- Directory.cs
- EditorBrowsableAttribute.cs
- login.cs
- MimeTextImporter.cs
- CollectionBase.cs
- XmlLangPropertyAttribute.cs
- CorePropertiesFilter.cs
- OleDbMetaDataFactory.cs
- ControlEvent.cs
- RowParagraph.cs
- DiscoveryMessageSequence11.cs
- ResponseStream.cs
- TriggerCollection.cs
- WizardPanel.cs
- XmlSerializerFactory.cs
- XmlSchemaSubstitutionGroup.cs
- StatusBarDrawItemEvent.cs