Skip to main content

List<string> to XML

Updated 1 min readMarkdown
List<string> to XML
// Example 1
List<string> items = new List<String>();
items.Add("sample1");
items.Add("sample2");
string str = "<no>" + String.Join("</no><no>", items) + "</no>";

// Example 2
List<string> countries = dc.SupplierCountries.Select(p=>p.CountryName).ToList();
string str = "<no>" + String.Join("</no><no>", countries) + "</no>";

About the author

No comments yet. Be the first to comment.

More from this blog