Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / MS / Internal / Data / XmlNodeComparer.cs / 1305600 / XmlNodeComparer.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: Defines XmlNodeComparer object, used to sort a view of data produced by an XmlDataSource. // // Specs: http://avalon/connecteddata/M5%20Specs/UIBinding.mht // //--------------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using System.Xml; using MS.Internal.Data; namespace MS.Internal.Data { ////// The XmlNodeComparer is used to sort a view of data produced by an XmlDataSource. /// internal class XmlNodeComparer : IComparer { ////// Constructor. /// /// array of sort parameters /// namespace manager, to control queries /// culture to use for comparisons internal XmlNodeComparer(SortDescriptionCollection sortParameters, XmlNamespaceManager namespaceManager, CultureInfo culture) { _sortParameters = sortParameters; _namespaceManager = namespaceManager; _culture = (culture == null) ? CultureInfo.InvariantCulture : culture; } int IComparer.Compare(object o1, object o2) { int result = 0; XmlNode node1 = o1 as XmlNode; XmlNode node2 = o2 as XmlNode; if (node1 == null) return -1; if (node2 == null) return +1; for (int k = 0; k < _sortParameters.Count; ++k) { string valueX = AssemblyHelper.SelectStringValue(node1, _sortParameters[k].PropertyName, _namespaceManager); string valueY = AssemblyHelper.SelectStringValue(node2, _sortParameters[k].PropertyName, _namespaceManager); result = String.Compare(valueX, valueY, false, _culture); if (_sortParameters[k].Direction == ListSortDirection.Descending) result = -result; if (result != 0) break; } return result; } private SortDescriptionCollection _sortParameters; private XmlNamespaceManager _namespaceManager; CultureInfo _culture; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ProcessModelInfo.cs
- DataGridViewCellValidatingEventArgs.cs
- XmlnsCache.cs
- DataTableMapping.cs
- HashUtility.cs
- DesignerActionVerbItem.cs
- MailHeaderInfo.cs
- ILGen.cs
- ResizeGrip.cs
- PromptStyle.cs
- OracleLob.cs
- ComboBox.cs
- RayHitTestParameters.cs
- ModuleBuilderData.cs
- GenericUriParser.cs
- XmlSchemaSimpleContentRestriction.cs
- CommandID.cs
- DocumentGridContextMenu.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- XmlSignatureProperties.cs
- IdlingCommunicationPool.cs
- EndpointDispatcher.cs
- ControlUtil.cs
- CodeExpressionCollection.cs
- XmlSchemaComplexType.cs
- TrackingWorkflowEventArgs.cs
- Propagator.Evaluator.cs
- xmlsaver.cs
- WebColorConverter.cs
- FileUpload.cs
- TemplateInstanceAttribute.cs
- WasHttpHandlersInstallComponent.cs
- WindowsGraphicsCacheManager.cs
- Marshal.cs
- QilFunction.cs
- SystemKeyConverter.cs
- AttributeExtensions.cs
- MessageFormatterConverter.cs
- SqlClientWrapperSmiStreamChars.cs
- XmlUtil.cs
- IteratorDescriptor.cs
- GlyphTypeface.cs
- OdbcConnectionOpen.cs
- WindowPatternIdentifiers.cs
- InputElement.cs
- MethodBuilder.cs
- JavaScriptSerializer.cs
- XPathScanner.cs
- CryptoConfig.cs
- Relationship.cs
- IndexedSelectQueryOperator.cs
- ToolTipAutomationPeer.cs
- KeyValueInternalCollection.cs
- FillErrorEventArgs.cs
- ExtractedStateEntry.cs
- CodePageUtils.cs
- DataColumnSelectionConverter.cs
- ConfigPathUtility.cs
- CodePropertyReferenceExpression.cs
- PropertySourceInfo.cs
- StylusPointPropertyId.cs
- SystemWebSectionGroup.cs
- OneToOneMappingSerializer.cs
- ExtensionSimplifierMarkupObject.cs
- ModifyActivitiesPropertyDescriptor.cs
- DecoderFallbackWithFailureFlag.cs
- DataGridViewTopRowAccessibleObject.cs
- ModelUIElement3D.cs
- InstanceDescriptor.cs
- QuaternionRotation3D.cs
- ObjectContextServiceProvider.cs
- Sql8ExpressionRewriter.cs
- GridItemProviderWrapper.cs
- Currency.cs
- KoreanLunisolarCalendar.cs
- FormViewRow.cs
- Decimal.cs
- CompilerError.cs
- SqlMultiplexer.cs
- Hyperlink.cs
- SqlClientFactory.cs
- ConsoleCancelEventArgs.cs
- ImmutableObjectAttribute.cs
- DynamicPhysicalDiscoSearcher.cs
- XmlArrayAttribute.cs
- Set.cs
- DataRowCollection.cs
- HiddenField.cs
- InternalResources.cs
- _OSSOCK.cs
- CreateUserWizardAutoFormat.cs
- DynamicArgumentDialog.cs
- DataGridViewCellCancelEventArgs.cs
- DisplayToken.cs
- DynamicControl.cs
- IndexerNameAttribute.cs
- Point3D.cs
- Permission.cs
- ObjectAssociationEndMapping.cs
- DataBindEngine.cs