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
- TemplateBaseAction.cs
- ComponentManagerBroker.cs
- Point3DAnimationBase.cs
- arabicshape.cs
- SortAction.cs
- FacetChecker.cs
- ImageIndexConverter.cs
- DataListComponentEditor.cs
- RoutedEventHandlerInfo.cs
- PhoneCallDesigner.cs
- CodeCompileUnit.cs
- TraceHandler.cs
- MetafileHeaderWmf.cs
- DatatypeImplementation.cs
- PageCodeDomTreeGenerator.cs
- MaskDesignerDialog.cs
- StdValidatorsAndConverters.cs
- PrimaryKeyTypeConverter.cs
- UiaCoreProviderApi.cs
- NameObjectCollectionBase.cs
- UmAlQuraCalendar.cs
- Matrix.cs
- ObjectReaderCompiler.cs
- CodeDOMProvider.cs
- _HelperAsyncResults.cs
- ReadOnlyAttribute.cs
- ComboBoxRenderer.cs
- FixedFindEngine.cs
- AnimationClockResource.cs
- ComplexBindingPropertiesAttribute.cs
- BrowserCapabilitiesFactory.cs
- AspNetSynchronizationContext.cs
- ProtocolElement.cs
- MarkupObject.cs
- List.cs
- Configuration.cs
- ComponentSerializationService.cs
- Matrix.cs
- PageVisual.cs
- QilIterator.cs
- SamlAssertion.cs
- SpellerStatusTable.cs
- ICspAsymmetricAlgorithm.cs
- DbMetaDataColumnNames.cs
- OdbcConnectionPoolProviderInfo.cs
- CategoryNameCollection.cs
- _NTAuthentication.cs
- sqlcontext.cs
- _ShellExpression.cs
- Color.cs
- UTF7Encoding.cs
- IdentifierCreationService.cs
- DbParameterHelper.cs
- ImageCodecInfo.cs
- Rect.cs
- HttpCachePolicyElement.cs
- WizardPanelChangingEventArgs.cs
- CompilationUnit.cs
- FileInfo.cs
- Pen.cs
- Oid.cs
- DesignTimeType.cs
- ProfilePropertySettingsCollection.cs
- EtwTrackingBehaviorElement.cs
- TypedRowHandler.cs
- TableLayoutRowStyleCollection.cs
- TcpPortSharing.cs
- EastAsianLunisolarCalendar.cs
- ColumnCollection.cs
- RangeContentEnumerator.cs
- UriParserTemplates.cs
- Identity.cs
- PenContexts.cs
- CompositeScriptReferenceEventArgs.cs
- ImageSourceConverter.cs
- TextDecorationUnitValidation.cs
- PageStatePersister.cs
- Int32CAMarshaler.cs
- DataConnectionHelper.cs
- DesigntimeLicenseContext.cs
- SelectionList.cs
- WebPartTransformerCollection.cs
- DbConnectionPool.cs
- DeclarativeCatalogPart.cs
- EventToken.cs
- EdmItemCollection.cs
- WizardStepBase.cs
- RetrieveVirtualItemEventArgs.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- IssuanceLicense.cs
- RealizationContext.cs
- TextLine.cs
- XsdDateTime.cs
- Debug.cs
- SymmetricSecurityBindingElement.cs
- HtmlControl.cs
- SoapFault.cs
- HashMembershipCondition.cs
- ScrollBar.cs
- UniqueIdentifierService.cs