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
- unsafenativemethodstextservices.cs
- TreeView.cs
- PersonalizationDictionary.cs
- MulticastOption.cs
- GAC.cs
- HtmlInputPassword.cs
- XsdSchemaFileEditor.cs
- TabControlCancelEvent.cs
- X509CertificateCollection.cs
- BrowserCapabilitiesFactoryBase.cs
- HtmlTableCellCollection.cs
- TextTabProperties.cs
- LinqDataSourceHelper.cs
- DrawingAttributes.cs
- DatagramAdapter.cs
- ContentTextAutomationPeer.cs
- ParserStack.cs
- DataGridColumnDropSeparator.cs
- BinaryKeyIdentifierClause.cs
- CommentEmitter.cs
- AlphabeticalEnumConverter.cs
- GlobalizationSection.cs
- ChtmlTextWriter.cs
- DataBinder.cs
- ReverseComparer.cs
- securitycriticaldataClass.cs
- SystemSounds.cs
- GeneralTransformGroup.cs
- SafeTokenHandle.cs
- MessageDecoder.cs
- SqlException.cs
- ExpressionEditor.cs
- columnmapfactory.cs
- EventLogEntry.cs
- Stackframe.cs
- Util.cs
- DiscoveryExceptionDictionary.cs
- Signature.cs
- HttpCookiesSection.cs
- UnmanagedMemoryStreamWrapper.cs
- BooleanSwitch.cs
- InputMethodStateTypeInfo.cs
- ListViewGroup.cs
- PageMediaType.cs
- TdsParser.cs
- ContainerVisual.cs
- BindingList.cs
- MessagePropertyFilter.cs
- ScriptingProfileServiceSection.cs
- ScrollBarAutomationPeer.cs
- ControlPropertyNameConverter.cs
- selecteditemcollection.cs
- BitmapDownload.cs
- MessageDecoder.cs
- CodeExpressionStatement.cs
- BCLDebug.cs
- XPathDescendantIterator.cs
- EdmToObjectNamespaceMap.cs
- ObjectResult.cs
- ProfileModule.cs
- OleDbPropertySetGuid.cs
- AssemblyNameProxy.cs
- DbConnectionFactory.cs
- CacheEntry.cs
- ListCollectionView.cs
- BindingCollection.cs
- StreamGeometry.cs
- StrokeRenderer.cs
- HttpContextWrapper.cs
- EncodingTable.cs
- ChangeConflicts.cs
- ToolStripPanel.cs
- LogExtentCollection.cs
- AddInBase.cs
- JapaneseLunisolarCalendar.cs
- ZipFileInfo.cs
- DashStyles.cs
- LazyInitializer.cs
- XsdValidatingReader.cs
- SmtpReplyReader.cs
- XmlSchemaParticle.cs
- SerializableAttribute.cs
- ParameterCollection.cs
- ChildChangedEventArgs.cs
- CookielessHelper.cs
- TypeProvider.cs
- AttributeQuery.cs
- FunctionDescription.cs
- formatter.cs
- XmlSequenceWriter.cs
- x509store.cs
- SolidColorBrush.cs
- ComplexLine.cs
- ClientApiGenerator.cs
- WebPartHeaderCloseVerb.cs
- BufferedGraphics.cs
- WindowsListViewItem.cs
- FormsAuthenticationUserCollection.cs
- BitVector32.cs
- ToolStripCodeDomSerializer.cs