Code:
/ 4.0 / 4.0 / 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. //---------------------------------------------------------------------------- // //// 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
- UniqueIdentifierService.cs
- ToolStripContainerActionList.cs
- OperationAbortedException.cs
- ResXResourceWriter.cs
- DataGridViewMethods.cs
- PointCollection.cs
- InternalTypeHelper.cs
- WeakReadOnlyCollection.cs
- TimersDescriptionAttribute.cs
- HashHelper.cs
- TemplateBindingExtension.cs
- ThrowHelper.cs
- _SSPISessionCache.cs
- UriTemplateEquivalenceComparer.cs
- ObjectQueryProvider.cs
- DiscoveryServerProtocol.cs
- CompatibleComparer.cs
- RuntimeCompatibilityAttribute.cs
- XPathNavigatorReader.cs
- DataGridViewTextBoxEditingControl.cs
- ApplicationSecurityManager.cs
- XmlSecureResolver.cs
- StringResourceManager.cs
- _ConnectionGroup.cs
- KeyMatchBuilder.cs
- EdmItemCollection.cs
- DataRowComparer.cs
- FakeModelItemImpl.cs
- linebase.cs
- LayeredChannelListener.cs
- metadatamappinghashervisitor.cs
- PassportAuthenticationEventArgs.cs
- DesignUtil.cs
- TextDecorationCollection.cs
- StructuralType.cs
- HtmlInputHidden.cs
- FormsAuthenticationUser.cs
- DesignerSerializerAttribute.cs
- ValueTypeFixupInfo.cs
- UDPClient.cs
- SqlMethodAttribute.cs
- PartDesigner.cs
- ButtonFieldBase.cs
- EventListener.cs
- ArrayTypeMismatchException.cs
- Pen.cs
- Utility.cs
- MediaPlayer.cs
- ParameterSubsegment.cs
- DataException.cs
- SymbolDocumentInfo.cs
- SchemaNames.cs
- Peer.cs
- ToolStripLabel.cs
- DataControlFieldsEditor.cs
- BuildProvider.cs
- DbModificationCommandTree.cs
- BitmapSourceSafeMILHandle.cs
- ListViewCancelEventArgs.cs
- SQLUtility.cs
- SqlCharStream.cs
- TableLayoutSettingsTypeConverter.cs
- Label.cs
- RuntimeConfigurationRecord.cs
- Translator.cs
- TypeForwardedToAttribute.cs
- TextMarkerSource.cs
- WorkflowRuntimeSection.cs
- GuidelineSet.cs
- BitmapFrameEncode.cs
- Enum.cs
- CharAnimationUsingKeyFrames.cs
- SettingsPropertyCollection.cs
- ChannelEndpointElement.cs
- ComponentEvent.cs
- NextPreviousPagerField.cs
- XmlAnyElementAttributes.cs
- ProvidePropertyAttribute.cs
- Stack.cs
- AutomationElementIdentifiers.cs
- ipaddressinformationcollection.cs
- TimeSpanSecondsConverter.cs
- DictionaryContent.cs
- SqlInfoMessageEvent.cs
- HijriCalendar.cs
- EntryWrittenEventArgs.cs
- UshortList2.cs
- HWStack.cs
- DataGridViewTextBoxEditingControl.cs
- EditorBrowsableAttribute.cs
- LinqMaximalSubtreeNominator.cs
- TypeDescriptor.cs
- ProxyManager.cs
- PublisherMembershipCondition.cs
- CalculatedColumn.cs
- dataSvcMapFileLoader.cs
- LongSumAggregationOperator.cs
- MemberInfoSerializationHolder.cs
- AccessorTable.cs
- TabControl.cs