Languages
[Edit]
EN

C#/.NET - convert List to Array

13 points
Created by:
Roseanne-Read
1335

In C#/.NET it is possible to convert List to array in fast way with ToArray method.

List<string> list = new List<string>()
{
	"A", "B", "C"
};

string[] array = list.ToArray();

for(int i = 0; i < array.Length; ++i)
	Console.Write(array[i] + " ");

Output:

A B C 

References

  1. List<T>.ToArray - Microsoft Docs
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

C# conversion

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join