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
- ProviderConnectionPointCollection.cs
- DataTableTypeConverter.cs
- ControlPropertyNameConverter.cs
- AutoGeneratedField.cs
- PersonalizationStateInfoCollection.cs
- SmtpLoginAuthenticationModule.cs
- EnumValAlphaComparer.cs
- DesigntimeLicenseContext.cs
- PointCollectionConverter.cs
- SchemaUtility.cs
- UniqueConstraint.cs
- FormatSettings.cs
- sqlser.cs
- MdiWindowListStrip.cs
- SchemaTypeEmitter.cs
- ObjectContext.cs
- ObjectDataSourceChooseTypePanel.cs
- BitmapCodecInfo.cs
- ImageField.cs
- AddInServer.cs
- DmlSqlGenerator.cs
- updatecommandorderer.cs
- XmlRootAttribute.cs
- InternalException.cs
- CompilerScope.Storage.cs
- EditorPart.cs
- MarkerProperties.cs
- NotifyInputEventArgs.cs
- MetadataUtil.cs
- SslStream.cs
- FocusChangedEventArgs.cs
- AssemblyEvidenceFactory.cs
- TextElementEnumerator.cs
- TextElementCollectionHelper.cs
- DependencyObjectPropertyDescriptor.cs
- FunctionQuery.cs
- TimeSpanValidatorAttribute.cs
- EdmItemCollection.cs
- RunWorkerCompletedEventArgs.cs
- BinaryObjectReader.cs
- ImageSource.cs
- DataStorage.cs
- DataBoundControl.cs
- ContextProperty.cs
- XPathDescendantIterator.cs
- InputProviderSite.cs
- CompilerError.cs
- FindProgressChangedEventArgs.cs
- FixedSOMTextRun.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- ThicknessAnimationUsingKeyFrames.cs
- BitmapPalettes.cs
- LifetimeServices.cs
- SwitchElementsCollection.cs
- Help.cs
- DataServiceResponse.cs
- StateMachineDesignerPaint.cs
- ModelItemExtensions.cs
- MultiBindingExpression.cs
- PositiveTimeSpanValidator.cs
- Lease.cs
- TextTreeUndo.cs
- ListItem.cs
- TextPatternIdentifiers.cs
- HostingEnvironmentWrapper.cs
- NumberFormatInfo.cs
- PDBReader.cs
- ZeroOpNode.cs
- XmlNotation.cs
- RequestSecurityTokenResponseCollection.cs
- PeerEndPoint.cs
- RoleService.cs
- EventLogger.cs
- COM2ColorConverter.cs
- DelimitedListTraceListener.cs
- ConfigXmlCDataSection.cs
- FontStretches.cs
- UserControlAutomationPeer.cs
- WeakEventManager.cs
- RenderData.cs
- PrtCap_Reader.cs
- AliasGenerator.cs
- HyperLinkColumn.cs
- PropertyToken.cs
- TableRowCollection.cs
- CompilationLock.cs
- sitestring.cs
- DispatcherHooks.cs
- CodeSnippetExpression.cs
- FunctionParameter.cs
- CommandHelper.cs
- DocumentPageViewAutomationPeer.cs
- SizeAnimationClockResource.cs
- IdentityNotMappedException.cs
- SpeechDetectedEventArgs.cs
- DataServiceResponse.cs
- ErrorEventArgs.cs
- InvariantComparer.cs
- SplashScreenNativeMethods.cs
- VectorAnimationBase.cs