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
- Attributes.cs
- MexHttpsBindingElement.cs
- BufferedWebEventProvider.cs
- SchemaEntity.cs
- BuilderPropertyEntry.cs
- FuncCompletionCallbackWrapper.cs
- MessageRpc.cs
- MethodBuilderInstantiation.cs
- ProgressBar.cs
- CommandExpr.cs
- XmlAggregates.cs
- CommandField.cs
- PartialList.cs
- SmiEventStream.cs
- SqlBuffer.cs
- DbProviderFactoriesConfigurationHandler.cs
- BitmapFrame.cs
- WebPartCatalogAddVerb.cs
- WebPartDisplayMode.cs
- ObjectQueryState.cs
- EFDataModelProvider.cs
- EntitySqlException.cs
- DataError.cs
- ExpressionValueEditor.cs
- WebPartHeaderCloseVerb.cs
- SmiMetaData.cs
- CompoundFileIOPermission.cs
- PowerStatus.cs
- ObjectNavigationPropertyMapping.cs
- WorkflowInstance.cs
- TextOptionsInternal.cs
- ToolStripPanel.cs
- TextEditorCharacters.cs
- ColorConverter.cs
- HtmlInputText.cs
- FrameworkTextComposition.cs
- MetadataPropertyAttribute.cs
- SystemWebCachingSectionGroup.cs
- ListBindingHelper.cs
- Site.cs
- StylusPointPropertyInfoDefaults.cs
- DependencyPropertyDescriptor.cs
- OutputCacheSettingsSection.cs
- TaskbarItemInfo.cs
- DataViewSetting.cs
- COM2ExtendedTypeConverter.cs
- EmissiveMaterial.cs
- Duration.cs
- PasswordValidationException.cs
- FormatVersion.cs
- WCFModelStrings.Designer.cs
- dataobject.cs
- AutomationPropertyInfo.cs
- SafeNativeMethods.cs
- _HTTPDateParse.cs
- TreeViewAutomationPeer.cs
- TrackBar.cs
- ConfigurationValidatorAttribute.cs
- QilTypeChecker.cs
- sqlinternaltransaction.cs
- ConstrainedGroup.cs
- MailAddressCollection.cs
- AutomationEventArgs.cs
- ProgressChangedEventArgs.cs
- LoginUtil.cs
- SplineKeyFrames.cs
- WebPartConnectionsDisconnectVerb.cs
- PcmConverter.cs
- QilFactory.cs
- ThrowHelper.cs
- MachineKeySection.cs
- WSSecureConversationDec2005.cs
- GeneratedContractType.cs
- DriveInfo.cs
- MultipleViewProviderWrapper.cs
- LiteralControl.cs
- RegisteredScript.cs
- EmptyStringExpandableObjectConverter.cs
- BaseComponentEditor.cs
- BlurEffect.cs
- SafeEventLogWriteHandle.cs
- IISMapPath.cs
- PeerCollaborationPermission.cs
- BrowserCapabilitiesCodeGenerator.cs
- ZipPackage.cs
- OdbcConnectionHandle.cs
- ViewGenerator.cs
- RenderTargetBitmap.cs
- RowTypePropertyElement.cs
- EntityContainerRelationshipSet.cs
- Exception.cs
- Number.cs
- FamilyCollection.cs
- DataGrid.cs
- ModifierKeysValueSerializer.cs
- Wizard.cs
- _ContextAwareResult.cs
- XmlNamespaceManager.cs
- DelayedRegex.cs
- EntityViewGenerationAttribute.cs