Download presentation
Presentation is loading. Please wait.
Published byScot Day Modified over 9 years ago
1
7/28/2003 (c) 2003 Orbonyx Corp. All Rights Reserved. GotDotNet – Building Upon the Framework Roy Ogborn, Independent.NET Consultant Orbonyx Corp. www.Orbonyx.com Downloads: www.Orbonyx.com/VS E-mail: Roy @ Orbonyx.com
2
7/28/2003 (c) 2003 Orbonyx Corp. All Rights Reserved. Sorting Collections GotDotNet – Building Upon the Framework
3
7/28/2003 (c) 2003 Orbonyx Corp. All Rights Reserved. At the end of this episode, you will … Learn how to use the IComparer and IComparable Interfaces See how easy it is to provide sorting to your business objects
4
7/28/2003 (c) 2003 Orbonyx Corp. All Rights Reserved. Why use comparing interfaces? Using dynamic SQL is inefficient and error prone. Using datasets to sort can also be inefficient and error prone. The.NET framework already knows how to sort. –You just need to give it a little guidance Business object functionality should be encapsulated within the object. It’s quick to implement!
5
7/28/2003 (c) 2003 Orbonyx Corp. All Rights Reserved. To Visual Studio Example
6
7/28/2003 (c) 2003 Orbonyx Corp. All Rights Reserved. Using IComparable Used for default sorting Used for comparing two like objects to see which is greater than the other.
7
7/28/2003 (c) 2003 Orbonyx Corp. All Rights Reserved. To Visual Studio Example
8
7/28/2003 (c) 2003 Orbonyx Corp. All Rights Reserved. Using IComparer Used for custom and varied sorting Use it by creating sorting “helper” classes.
9
7/28/2003 (c) 2003 Orbonyx Corp. All Rights Reserved. To Visual Studio Example
10
7/28/2003 (c) 2003 Orbonyx Corp. All Rights Reserved. What we learned How and when to use IComparable and IComparer interfaces How to quickly provide sorting for custom business collections
11
7/28/2003 (c) 2003 Orbonyx Corp. All Rights Reserved. Resources MSDN –Knowledge Base KB321292 Visual Studio Help. See: –IComparer and IComparable –Array.Sort, ArrayList.Sort, SortedList –Collections
12
7/28/2003 (c) 2003 Orbonyx Corp. All Rights Reserved. Roy Ogborn, Independent Consultant Orbonyx Corp. www.Orbonyx.com Downloads: www.Orbonyx.com/VS E-mail: Roy @ Orbonyx.com Enjoy!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.