Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to convert a list to string in C#?
Declare a list.
List l = new List ();
Now, add elements to the list.
// elements
l.Add("Accessories");
l.Add("Footwear");
l.Add("Watches");
Now convert it into a string.
string str = string.Join(" ", l.ToArray());
Let us see the final code to convert a list to string in C# −
Example
using System;
using System.Collections.Generic;
class Demo {
static void Main() {
List l = new List ();
// elements
l.Add("Accessories");
l.Add("Footwear");
l.Add("Watches");
string str = string.Join(" ", l.ToArray());
Console.WriteLine(str);
}
} Advertisements
