Read value from List<List<Word>>

103 Views Asked by At

I have following code in my C# project:

List<List<Word>> RecognizedPlates = 
DetectLicensePlate(img, licensePlateImagesList, filteredLicensePlateImagesList, licenseBoxList);
foreach (List<Word> W in RecognizedPlates)
{
     richTextBox1.Text = W.ToString();
}

could anyone please help to read text from List<List<Word>> RecognizedPlates I get nothing in richTextBox after execution this code.

1

There are 1 best solutions below

0
Sergey Kalinichenko On

If you would like to make a big string from a list containing lists of words, use string.Join, like this:

richTextBox1.Text = string.Join("\n", RecognizedPlates.Select(list =>
    string.Join(" ", list)
));

This would produce a string with the content of individual lists joined by spaces, separated by '\n' characters. For example, a list of lists like this

{{"quick", "brown"}, {"fox", "jumps", "over"}, {"the", "lazy", "dog"}}

will be converted to this:

quick brown
fox jumps over
the lazy dog