एक सूची घोषित करें।
Listl = new List ();
अब, सूची में तत्व जोड़ें।
// तत्व
l.Add("Accessories");
l.Add("Footwear");
l.Add("Watches");
अब इसे स्ट्रिंग में बदलें।
string str = string.Join(" ", l.ToArray());
आइए C# में सूची को स्ट्रिंग में बदलने का अंतिम कोड देखें:
उदाहरण
using System;
using System.Collections.Generic;
class Demo {
static void Main() {
List l = new List();
// तत्व
l.Add("Accessories");
l.Add("Footwear");
l.Add("Watches");
string str = string.Join(" ", l.ToArray());
Console.WriteLine(str);
}
}