I have been busy recently and haven't updated it for a long time. This article is very simple. Net 4.0 adds a data type tuple and icomparable interfaces.
Tuple It is a factory class and provides a static method for creating instances of the tuples supported by. NET Framework. It provides helper methods that can be called to instantiate a specific tuples object without explicitly specifying the type of each tuple component.
Static void main (string [] ARGs) {var T = tuple. create <int, String, decimal, bool, myclass> (1, "test", 2, true, new myclass {id = 3}); console. writeline (T. item1); console. writeline (T. item5.id); console. read () ;}public class myclass {public int ID {Get; Set ;}}
It's easy. Item {number} is the position of your generic type.
Icomparable
Icomparable has this non-generic interface and an icomparable <t> generic interface that inherits one of the two implementations.CodeProvides the type Implementation of sortable values. The method used to implement the interface is compareto.
The Old Zhao has a detailed explanation in this regard. If I have limited capabilities, I 'd like to give it to you directly: Performance Comparison of the array sorting method (1): Considerations and tests