C # basic series-Data Structure

Source: Internet
Author: User

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

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.