Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Converting Generic List to Array using C#
WhatsApp
Lajapathy Arun
12y
72
k
0
1
25
Blog
In this Blog we are going to see. How to Convert Generic List to ARRAY using C#
Used Namespace:
using
System.Collections.Generic;
Code Snippet:
///
<summary>
///
This Converts List To Array
///
</summary>
public
void
ConvertingListTOArray()
{
//Adding item to the List
List
<
string
> list =
new
List
<
string
>();
list.Add(
"Lajapathy"
);
list.Add(
"Arun"
);
//Convert List to Array
Array
array = list.
ToArray
();
//Convert List to Array
string
[] array1 = list.
ToArray
();
//Displaying the Array Value.
foreach
(
string
s
in
array1)
{
Console
.WriteLine(
Environment
.NewLine);
Console
.WriteLine(s);
}
}
Output:
Lajapathy
Arun
Thanks for reading this article. Have a nice day.
Up Next
Converting Generic List to String and Vice Versa using C#
Ebook Download
View all
Diving Into Microsoft .NET Entity Framework
Read by 13.4k people
Download Now!
Learn
View all
Membership not found