Languages
[Edit]
EN

C# / .NET - convert List to Array

1 points
Created by:
Root-ssh
6550

1. List.ToArray method example

List<int> list = new List<int>()
{
	1, 2, 3
};

int[] array = list.ToArray();

foreach (int entry in array)
	Console.Write(entry + " ");

Output:

1 2 3

2. References

  1. List.ToArray Method - Microsoft Docs
Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.