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
- GridProviderWrapper.cs
- PageContentAsyncResult.cs
- ScrollViewerAutomationPeer.cs
- ContainerParagraph.cs
- TypeInfo.cs
- HostDesigntimeLicenseContext.cs
- RequestContext.cs
- BrowserCapabilitiesCompiler.cs
- StringUtil.cs
- RecognizerBase.cs
- BitmapEffect.cs
- SessionIDManager.cs
- IdnElement.cs
- AttributeEmitter.cs
- FileDialogCustomPlace.cs
- Opcode.cs
- ZipIOCentralDirectoryFileHeader.cs
- SupportingTokenDuplexChannel.cs
- CommandLibraryHelper.cs
- FormParameter.cs
- StringBlob.cs
- IDReferencePropertyAttribute.cs
- DynamicEndpointElement.cs
- RectAnimationBase.cs
- OverrideMode.cs
- FormsAuthenticationModule.cs
- StringReader.cs
- HttpResponseInternalWrapper.cs
- ArrangedElementCollection.cs
- BatchServiceHost.cs
- ZipIOModeEnforcingStream.cs
- ShaperBuffers.cs
- SR.cs
- Vector3DCollectionConverter.cs
- ArraySortHelper.cs
- LayoutEditorPart.cs
- IntPtr.cs
- Pair.cs
- WebServiceHostFactory.cs
- HttpListenerRequest.cs
- WebPartDisplayModeEventArgs.cs
- StringSorter.cs
- HTTPAPI_VERSION.cs
- SmtpMail.cs
- SmiSettersStream.cs
- ServicesUtilities.cs
- HTTPAPI_VERSION.cs
- ContainsRowNumberChecker.cs
- MultilineStringConverter.cs
- DiscoveryDocumentSerializer.cs
- TextServicesPropertyRanges.cs
- HwndTarget.cs
- RemotingConfiguration.cs
- ConfigurationElementProperty.cs
- CannotUnloadAppDomainException.cs
- XmlSignificantWhitespace.cs
- PropertyIDSet.cs
- DesignerCategoryAttribute.cs
- SystemUnicastIPAddressInformation.cs
- TrackingMemoryStreamFactory.cs
- FocusManager.cs
- Properties.cs
- HelpFileFileNameEditor.cs
- ZipIOExtraFieldPaddingElement.cs
- HttpListenerContext.cs
- PolicyValidationException.cs
- ProfileGroupSettings.cs
- CommonDialog.cs
- DataGridViewAutoSizeModeEventArgs.cs
- HttpHandlerActionCollection.cs
- TemplateNameScope.cs
- OleDbException.cs
- Activation.cs
- EntryWrittenEventArgs.cs
- DataRelation.cs
- NegotiationTokenAuthenticatorState.cs
- GZipUtils.cs
- ArrayTypeMismatchException.cs
- DataPagerFieldItem.cs
- RijndaelManaged.cs
- PrimaryKeyTypeConverter.cs
- RectKeyFrameCollection.cs
- MethodToken.cs
- NumberFunctions.cs
- LinearGradientBrush.cs
- WindowsListViewSubItem.cs
- OleDbParameter.cs
- securitycriticaldataClass.cs
- Message.cs
- RequestQueue.cs
- DeploymentExceptionMapper.cs
- TextChangedEventArgs.cs
- ValidationRuleCollection.cs
- CommandCollectionEditor.cs
- NodeLabelEditEvent.cs
- FormsAuthentication.cs
- HtmlHistory.cs
- GenericTypeParameterBuilder.cs
- BezierSegment.cs
- CodeMemberEvent.cs