Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Base / System / ComponentModel / SortDescription.cs / 2 / SortDescription.cs
//---------------------------------------------------------------------------- // //// Copyright (C) 2003 by Microsoft Corporation. All rights reserved. // // // // Description: Defines property and direction to sort. // // See spec at [....]/connecteddata/M5%20Specs/IDataCollection.mht // // History: // 06/02/2003 : [....] - Created // //--------------------------------------------------------------------------- using System; using System.ComponentModel; using System.Windows; // SR namespace System.ComponentModel { ////// Defines a property and direction to sort a list by. /// public struct SortDescription { //----------------------------------------------------- // // Public Constructors // //----------------------------------------------------- #region Public Constructors ////// Create a sort description. /// /// Property to sort by /// Specifies the direction of sort operation ///direction is not a valid value for ListSortDirection public SortDescription(string propertyName, ListSortDirection direction) { if (direction != ListSortDirection.Ascending && direction != ListSortDirection.Descending) throw new InvalidEnumArgumentException("direction", (int)direction, typeof(ListSortDirection)); _propertyName = propertyName; _direction = direction; _sealed = false; } #endregion Public Constructors //------------------------------------------------------ // // Public Properties // //----------------------------------------------------- #region Public Properties ////// Property name to sort by. /// public string PropertyName { get { return _propertyName; } set { if (_sealed) throw new InvalidOperationException(SR.Get(SRID.CannotChangeAfterSealed, "SortDescription")); _propertyName = value; } } ////// Sort direction. /// public ListSortDirection Direction { get { return _direction; } set { if (_sealed) throw new InvalidOperationException(SR.Get(SRID.CannotChangeAfterSealed, "SortDescription")); if (value < ListSortDirection.Ascending || value > ListSortDirection.Descending) throw new InvalidEnumArgumentException("value", (int) value, typeof(ListSortDirection)); _direction = value; } } ////// Returns true if the SortDescription is in use (sealed). /// public bool IsSealed { get { return _sealed; } } #endregion Public Properties //------------------------------------------------------ // // Public methods // //------------------------------------------------------ #region Public Methods ///Override of Object.Equals public override bool Equals(object obj) { return (obj is SortDescription) ? (this == (SortDescription)obj) : false; } ///Equality operator for SortDescription. public static bool operator==(SortDescription sd1, SortDescription sd2) { return sd1.PropertyName == sd2.PropertyName && sd1.Direction == sd2.Direction; } ///Inequality operator for SortDescription. public static bool operator!=(SortDescription sd1, SortDescription sd2) { return !(sd1 == sd2); } ///Override of Object.GetHashCode public override int GetHashCode() { return unchecked(PropertyName.GetHashCode() + Direction.GetHashCode()); } #endregion Public Methods //----------------------------------------------------- // // Internal methods // //------------------------------------------------------ #region Internal Methods internal void Seal() { _sealed = true; } #endregion Internal Methods //----------------------------------------------------- // // Private Fields // //----------------------------------------------------- #region Private Fields private string _propertyName; private ListSortDirection _direction; bool _sealed; #endregion Private Fields } } // 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
- DataGridViewCellStyle.cs
- TypedDataSourceCodeGenerator.cs
- ValueSerializer.cs
- AttributeQuery.cs
- MimeMultiPart.cs
- LockedBorderGlyph.cs
- AvTraceDetails.cs
- PageTheme.cs
- KeyValueSerializer.cs
- DataServiceQueryProvider.cs
- TextBlockAutomationPeer.cs
- ContainerUtilities.cs
- PersonalizationAdministration.cs
- SqlFactory.cs
- PropertyFilterAttribute.cs
- FormsAuthenticationModule.cs
- WindowAutomationPeer.cs
- Cursors.cs
- XmlWrappingReader.cs
- AmbientValueAttribute.cs
- ClaimTypeRequirement.cs
- MetadataArtifactLoaderComposite.cs
- DecimalFormatter.cs
- ConnectionManagementElement.cs
- CodePrimitiveExpression.cs
- HttpCapabilitiesSectionHandler.cs
- ReadOnlyHierarchicalDataSourceView.cs
- XmlSchemaAttributeGroupRef.cs
- DirectoryNotFoundException.cs
- Itemizer.cs
- _SpnDictionary.cs
- LineServices.cs
- EdmToObjectNamespaceMap.cs
- CustomErrorsSection.cs
- LinkedResource.cs
- ObjectConverter.cs
- Vector3D.cs
- ClientSettingsStore.cs
- Bits.cs
- ProcessingInstructionAction.cs
- NameValueFileSectionHandler.cs
- ReferenceAssemblyAttribute.cs
- TogglePatternIdentifiers.cs
- TableRow.cs
- LinkedResource.cs
- SamlDelegatingWriter.cs
- BlockUIContainer.cs
- AppSettingsReader.cs
- Timer.cs
- ImportStoreException.cs
- MoveSizeWinEventHandler.cs
- EventDescriptor.cs
- PropertyChangedEventManager.cs
- ObjectDataSourceWizardForm.cs
- BrowserCapabilitiesFactory.cs
- State.cs
- ADRoleFactoryConfiguration.cs
- BrushValueSerializer.cs
- IndividualDeviceConfig.cs
- CmsInterop.cs
- DesignTimeTemplateParser.cs
- CollectionBase.cs
- UndoManager.cs
- DbProviderFactoriesConfigurationHandler.cs
- CorrelationQuery.cs
- WorkflowOperationErrorHandler.cs
- SettingsBindableAttribute.cs
- SecureConversationDriver.cs
- LineServices.cs
- StrokeNodeOperations2.cs
- ImageListImageEditor.cs
- ConnectionStringSettings.cs
- BindingValueChangedEventArgs.cs
- X509CertificateClaimSet.cs
- ArcSegment.cs
- ImageListImage.cs
- TextLine.cs
- ReflectPropertyDescriptor.cs
- WindowsHyperlink.cs
- GPPOINT.cs
- IteratorDescriptor.cs
- AppDomainAttributes.cs
- TransportOutputChannel.cs
- UITypeEditors.cs
- VScrollProperties.cs
- Animatable.cs
- DataGridViewColumnHeaderCell.cs
- OneToOneMappingSerializer.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- CommonDialog.cs
- MenuCommand.cs
- Peer.cs
- CompiledXpathExpr.cs
- TreeNodeCollectionEditorDialog.cs
- NativeStructs.cs
- DataBinder.cs
- CachedPathData.cs
- SmtpClient.cs
- ImageFormatConverter.cs
- ParseNumbers.cs