Diesel Posted July 27, 2004 Posted July 27, 2004 Ok, what are the advantages of implementing IComparable and the CompareTo function (which takes an object as a parameter) as opposed to just creating my own static function CompareTo that takes my class type as a parameter? Quote
Administrators PlausiblyDamp Posted July 27, 2004 Administrators Posted July 27, 2004 If you implement IComparable then your class / structure can be used anywhere the IComparable interface is expected, including parts of the .Net Framework (e.g. Array.Sort) If you coded your own function then you would only be able to use it in a limited number of places (i.e. your own code) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.