Click here to Skip to main content
15,885,019 members
Articles / Programming Languages / C#

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

Rate me:
Please Sign up or sign in to vote.
4.89/5 (13 votes)
13 Feb 2008CPOL8 min read 75.1K   495   72  
This article presents a simple and flexible way to sort strongly-typed lists of business objects using multiple properties or fields.
Direct access
MyEntity.Name	GetValue	8ms
MyEntity.Name	SetValue	97ms
MyEntity.Name	ValueChanged	1022ms
OpCount: 25000000

Without HyperTypeDescriptionProvider
MyEntity.Name	GetProperties	647ms
MyEntity.Name	IsReadOnly	2926ms
MyEntity.Name	SupportsChangeEvents	245ms
MyEntity.Name	GetValue	10360ms
MyEntity.Name	SetValue	20288ms
MyEntity.Name	ValueChanged	29566ms
OpCount: 25000000
MySuperEntity.Name	GetProperties	828ms
MySuperEntity.Name	IsReadOnly	2881ms
MySuperEntity.Name	SupportsChangeEvents	241ms
MySuperEntity.Name	GetValue	10682ms
MySuperEntity.Name	SetValue	20730ms
MySuperEntity.Name	ValueChanged	30979ms
OpCount: 25000000
MySuperEntity.When	GetProperties	825ms
MySuperEntity.When	IsReadOnly	2888ms
MySuperEntity.When	SupportsChangeEvents	251ms
MySuperEntity.When	GetValue	11393ms
MySuperEntity.When	SetValue	22416ms
OpCount: 10000000

With HyperTypeDescriptionProvider
MyEntity.Name	GetProperties	699ms
MyEntity.Name	IsReadOnly	43ms
MyEntity.Name	SupportsChangeEvents	41ms
MyEntity.Name	GetValue	57ms
MyEntity.Name	SetValue	155ms
MyEntity.Name	ValueChanged	954ms
OpCount: 25000000
MySuperEntity.Name	GetProperties	914ms
MySuperEntity.Name	IsReadOnly	41ms
MySuperEntity.Name	SupportsChangeEvents	44ms
MySuperEntity.Name	GetValue	95ms
MySuperEntity.Name	SetValue	173ms
MySuperEntity.Name	ValueChanged	1059ms
OpCount: 25000000
MySuperEntity.When	GetProperties	891ms
MySuperEntity.When	IsReadOnly	41ms
MySuperEntity.When	SupportsChangeEvents	46ms
MySuperEntity.When	GetValue	295ms
MySuperEntity.When	SetValue	110ms
OpCount: 10000000

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)


Written By
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 | :)

Comments and Discussions