Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / MS / Internal / Data / XmlNodeComparer.cs / 1 / 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 = XmlHelper.SelectStringValue(node1, _sortParameters[k].PropertyName, _namespaceManager); string valueY = XmlHelper.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. //---------------------------------------------------------------------------- // //// 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 = XmlHelper.SelectStringValue(node1, _sortParameters[k].PropertyName, _namespaceManager); string valueY = XmlHelper.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
- XmlSchemaFacet.cs
- XmlCodeExporter.cs
- GroupBoxRenderer.cs
- OperandQuery.cs
- TextRunCache.cs
- GridEntryCollection.cs
- RemoteWebConfigurationHostStream.cs
- FamilyMap.cs
- ApplicationSecurityInfo.cs
- ObjectCloneHelper.cs
- CompilerTypeWithParams.cs
- DesignerAttribute.cs
- BindingWorker.cs
- StrokeCollection2.cs
- QuaternionIndependentAnimationStorage.cs
- SafeRegistryHandle.cs
- SystemPens.cs
- SRDisplayNameAttribute.cs
- RightsManagementInformation.cs
- VisualBasic.cs
- DesignerForm.cs
- DataSetSchema.cs
- WizardPanelChangingEventArgs.cs
- SafeTimerHandle.cs
- FileFormatException.cs
- SqlMetaData.cs
- SHA1Managed.cs
- GZipDecoder.cs
- XPathItem.cs
- ActiveXHost.cs
- ListViewItem.cs
- DictionarySectionHandler.cs
- QilLiteral.cs
- TextServicesDisplayAttributePropertyRanges.cs
- ColorBlend.cs
- ControlDesigner.cs
- templategroup.cs
- TextDecoration.cs
- LinearGradientBrush.cs
- LineGeometry.cs
- OverflowException.cs
- RegionIterator.cs
- OleDbMetaDataFactory.cs
- XmlTextWriter.cs
- WebBrowserSiteBase.cs
- COM2PropertyPageUITypeConverter.cs
- VisualBrush.cs
- ReadOnlyActivityGlyph.cs
- NullableBoolConverter.cs
- GifBitmapDecoder.cs
- KeyMatchBuilder.cs
- XmlSchemaSimpleTypeRestriction.cs
- ListGeneralPage.cs
- TemplateEditingService.cs
- Location.cs
- OrderedDictionary.cs
- ConfigurationManagerHelperFactory.cs
- ColumnResizeUndoUnit.cs
- UriParserTemplates.cs
- DataColumnChangeEvent.cs
- DesignerAdapterAttribute.cs
- ZipIOExtraFieldElement.cs
- StyleBamlTreeBuilder.cs
- DataStorage.cs
- SpeechDetectedEventArgs.cs
- ControlPager.cs
- Collection.cs
- ProcessHostFactoryHelper.cs
- XmlSerializationGeneratedCode.cs
- EastAsianLunisolarCalendar.cs
- TemplateControlBuildProvider.cs
- GlyphCache.cs
- XmlSchemaCollection.cs
- ClientTargetCollection.cs
- PeerApplication.cs
- ZoomPercentageConverter.cs
- ListItem.cs
- BufferedReadStream.cs
- RijndaelManagedTransform.cs
- StyleXamlTreeBuilder.cs
- _SafeNetHandles.cs
- AuthenticationService.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- TemplateBindingExpressionConverter.cs
- WebPartConnectionsDisconnectVerb.cs
- ReadWriteSpinLock.cs
- CacheSection.cs
- SolidColorBrush.cs
- HttpHandlerActionCollection.cs
- HtmlInputPassword.cs
- FtpCachePolicyElement.cs
- ExpressionBindingCollection.cs
- SoapDocumentServiceAttribute.cs
- RightsManagementEncryptionTransform.cs
- Timer.cs
- TimersDescriptionAttribute.cs
- Exceptions.cs
- ResourceProviderFactory.cs
- WindowsScrollBarBits.cs
- DurableInstance.cs