xaml:
C#
xaml.cs
C#
List liststStringParsed = new List();
liststStringParsed.Add("a");
liststStringParsed.Add("b");
liststStringParsed.Add("c");
gTBxChar2 = liststStringParsed[2];"gTBxChar2 = liststStringParsed[2]" is not acceptable.
How do I convert a list element to text?

Mahesh ChandRank #1 · 393.2K reputationPosted Nov 29, 2024, 3:47 PM EST
string result = String.Join(",", liststStringParsed);
Here is a detailed article: How To Convert a List to a String in C#
https://www.c-sharpcorner.com/article/convert-list-of-strings-into-single-string/
Jignesh KumarRank #91 · 22.9K reputationPosted Nov 30, 2024, 5:26 AM EST
Hello,
You're missing the
.Textproperty for your input. Try the example below, and it should work. If you'd like to display all the items as a comma-separated string, you can usestring.Join()to combine the strings.List liststStringParsed = new List(); liststStringParsed.Add("a"); liststStringParsed.Add("b"); liststStringParsed.Add("c"); gTBxChar2.Text = liststStringParsed[2];Or
// Combine list values with a comma and assign to the TextBox gTBxChar2.Text = string.Join(", ", liststStringParsed);