Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Generic Multi-Field/Property Sorting for Lists of Business Objects

, 13 Feb 2008 CPOL
This article presents a simple and flexible way to sort strongly-typed lists of business objects using multiple properties or fields.
multisortsourceanddemo.zip
MultiSortLib
bin
Debug
MultiSortLib.dll
Release
MultiSortLib.instr.pdb
Properties
HyperPropertyDescriptor
HyperPropertyDescriptor
bin
Release
HyperPropertyDescriptor.csproj.user
Properties
HyperPropertyDescriptorSample
bin
Release
HyperPropertyDescriptor.dll
HyperPropertyDescriptor.pdb
HyperPropertyDescriptorSample.exe
HyperPropertyDescriptorSample.pdb
HyperPropertyDescriptorSample.csproj.user
Properties
MultiSortDemo
bin
Debug
MultiSortDemo.exe
MultiSortDemo.vshost.exe
MultiSortLib.dll
Release
MultiSortDemo.instr.pdb
MultiSortDemo.vshost.exe
MultiSortLib.instr.pdb
Properties
DataSources
WorkItem.datasource
WorkItemPropertyName.datasource
Settings.settings
using System;
using System.ComponentModel;

namespace Hyper.ComponentModel {
    public abstract class ChainingPropertyDescriptor : PropertyDescriptor {
        private readonly PropertyDescriptor _root;
        protected PropertyDescriptor Root { get { return _root; } }
        protected ChainingPropertyDescriptor(PropertyDescriptor root)
            : base(root) {
            _root = root;
        }
        public override void AddValueChanged(object component, EventHandler handler) {
            Root.AddValueChanged(component, handler);
        }
        public override AttributeCollection Attributes {
            get {
                return Root.Attributes;
            }
        }
        public override bool CanResetValue(object component) {
            return Root.CanResetValue(component);
        }
        public override string Category {
            get {
                return Root.Category;
            }
        }
        public override Type ComponentType {
            get { return Root.ComponentType; }
        }
        public override TypeConverter Converter {
            get {
                return Root.Converter;
            }
        }
        public override string Description {
            get {
                return Root.Description;
            }
        }
        public override bool DesignTimeOnly {
            get {
                return Root.DesignTimeOnly;
            }
        }
        public override string DisplayName {
            get {
                return Root.DisplayName;
            }
        }
        public override bool Equals(object obj) {
            return Root.Equals(obj);
        }
        public override PropertyDescriptorCollection GetChildProperties(object instance, Attribute[] filter) {
            return Root.GetChildProperties(instance, filter);
        }
        public override object GetEditor(Type editorBaseType) {
            return Root.GetEditor(editorBaseType);
        }
        public override int GetHashCode() {
            return Root.GetHashCode();
        }
        public override object GetValue(object component) {
            return Root.GetValue(component);
        }
        public override bool IsBrowsable {
            get {
                return Root.IsBrowsable;
            }
        }
        public override bool IsLocalizable {
            get {
                return Root.IsLocalizable;
            }
        }
        public override bool IsReadOnly {
            get { return Root.IsReadOnly; }
        }
        public override string Name {
            get {
                return Root.Name;
            }
        }
        public override Type PropertyType {
            get { return Root.PropertyType; }
        }
        public override void RemoveValueChanged(object component, EventHandler handler) {
            Root.RemoveValueChanged(component, handler);
        }
        public override void ResetValue(object component) {
            Root.ResetValue(component);
        }
        public override void SetValue(object component, object value) {
            Root.SetValue(component, value);
        }
        public override bool ShouldSerializeValue(object component) {
            return Root.ShouldSerializeValue(component);
        }
        public override bool SupportsChangeEvents {
            get {
                return Root.SupportsChangeEvents;
            }
        }
        public override string ToString() {
            return Root.ToString();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

owen654321
Software Developer (Senior) Troppus Software
United States United States
Currently working as a Senior Silverlight Developer with Troppus Software in Superior, CO. I enjoy statistics, programming, new technology, playing the cello, and reading codeproject articles. Smile | :)

| Advertise | Privacy | Mobile
Web02 | 2.8.141015.1 | Last Updated 13 Feb 2008
Article Copyright 2007 by owen654321
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid