Wrox Programmer Forums
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 30th, 2008, 12:12 AM
Registered User
Join Date: May 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default iComparable

Hey guys, I am having a great difficulty in understanding the use of iComparable from the Wrox ASP.NET 2.0 book(proffesionals).
 Can anyone explain this to me or provide some neat links to understand?

Old May 30th, 2008, 02:39 AM
samjudson's Avatar
Friend of Wrox
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts

I don't have access to the book, but here's how I view the interface.

IComparable is used to allow two objects of the same type to be compared. This allows them to be sorted and ordered (such as when using sorted lists).

The method IComparable provides, CompareTo, simply compares the current object with the supplied parameter, returning 0 if the two items are identical, -1 if the instance is less than the parameter, and +1 if the instance is greater than the parameter.

/- Sam Judson : Wrox Technical Editor -/

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.