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
- QueryConverter.cs
- WebZone.cs
- PointAnimationBase.cs
- FontNameConverter.cs
- DataGridPagerStyle.cs
- unsafeIndexingFilterStream.cs
- DbParameterCollectionHelper.cs
- ModuleBuilder.cs
- RSAProtectedConfigurationProvider.cs
- ActiveDocumentEvent.cs
- ReadOnlyPropertyMetadata.cs
- DesignerForm.cs
- WebPartEditVerb.cs
- XamlFigureLengthSerializer.cs
- Int64KeyFrameCollection.cs
- RecognizeCompletedEventArgs.cs
- AsyncPostBackTrigger.cs
- ToolboxDataAttribute.cs
- WindowsRichEdit.cs
- StreamWriter.cs
- SqlDependencyListener.cs
- CodeAccessSecurityEngine.cs
- HwndStylusInputProvider.cs
- URLAttribute.cs
- DataGridViewToolTip.cs
- AdapterUtil.cs
- FileSecurity.cs
- HelpPage.cs
- RadioButtonBaseAdapter.cs
- ComplexPropertyEntry.cs
- IndexerNameAttribute.cs
- ErasingStroke.cs
- NetMsmqSecurityElement.cs
- HttpResponseMessageProperty.cs
- ResourceExpressionEditorSheet.cs
- MemoryMappedFileSecurity.cs
- ErrorStyle.cs
- DefaultValueConverter.cs
- M3DUtil.cs
- ClientFormsAuthenticationMembershipProvider.cs
- BitmapEffectrendercontext.cs
- FunctionUpdateCommand.cs
- Serializer.cs
- DiagnosticEventProvider.cs
- SiteMapDataSourceView.cs
- AbandonedMutexException.cs
- MultiDataTrigger.cs
- PrintPreviewControl.cs
- TemplatePagerField.cs
- CodeMemberField.cs
- XmlDownloadManager.cs
- MbpInfo.cs
- CodePageUtils.cs
- FixedPageProcessor.cs
- SecurityKeyIdentifier.cs
- JsonDataContract.cs
- ShutDownListener.cs
- smtpconnection.cs
- DmlSqlGenerator.cs
- DoubleLinkListEnumerator.cs
- TableRowGroup.cs
- SqlLiftIndependentRowExpressions.cs
- SettingsSection.cs
- GroupQuery.cs
- TextElement.cs
- WebConfigurationManager.cs
- DataBoundControl.cs
- CompilerCollection.cs
- TypedColumnHandler.cs
- BlobPersonalizationState.cs
- DefaultMemberAttribute.cs
- MeasureData.cs
- SyndicationDeserializer.cs
- BorderSidesEditor.cs
- XmlSchemaObjectCollection.cs
- HtmlUtf8RawTextWriter.cs
- CollectionType.cs
- XmlSchemaIdentityConstraint.cs
- HWStack.cs
- UnsafeNativeMethodsCLR.cs
- LinearGradientBrush.cs
- PageClientProxyGenerator.cs
- TypeLibConverter.cs
- Error.cs
- XmlSchemaFacet.cs
- FileDialogCustomPlace.cs
- ToolStripItemRenderEventArgs.cs
- Point4DValueSerializer.cs
- SmtpSection.cs
- RadioButton.cs
- WindowsEditBoxRange.cs
- StringInfo.cs
- HandledMouseEvent.cs
- DataGridCellClipboardEventArgs.cs
- BuildTopDownAttribute.cs
- ComponentChangingEvent.cs
- HtmlTernaryTree.cs
- validation.cs
- UriExt.cs
- SystemMulticastIPAddressInformation.cs