Methods for converting between list and array in C #

Source: Internet
Author: User

The example in this article describes how to convert a list and array in C #. Share to everyone for your reference. The specific analysis is as follows:

One, list to array (from list<string> to string[])

List<string> lists=new list<string> () lists.add ("str"); Lists.add ("Hello"); string[] Str=lists.toarray ( );

Second, array goto list (from string[] to list<string>)

string[] str={"str", "string", "abc"}; list<string> lists=new list<string> (str);

I hope this article is helpful to everyone's C # programming.

In addition to the Declaration, Running GuestArticles are original, reproduced please link to the form of the address of this article
Methods for converting between list and array in C #

This address: http://www.paobuke.com/develop/c-develop/pbk23144.html






Related Content C # wx_location Three keywords in C # params,ref,outc# the difference between abstract class and interface in C # simple way to access SQLite database (installation, connection, query, etc.)
C#?a ¢? Dμ?à????? Ê?? Ú??? Ò?? C # Implement methods for writing program run information to the log method C # image Edge detection (Roberts) delegate, event learning notes in C #

Methods for converting between list and array in C #

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.