0

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
    What's is the `Word`? Furthermore, since you make a foreach, only the the last `Word` would be presented in the `richTextBox1` text at the end. What are you trying to achieve? – Christos Feb 12 '15 at 16:32
  • 1
    " I get nothing in richTextBox after execution this code.", make sure you are getting back some data in your list, otherwise you should end up with something like `System.Collections.Generic.List``1[Word]`, *which is another problem*. – Habib Feb 12 '15 at 16:32
  • @Christos Word comes from Tessnet2.Word, I am trying to read whole content from 'RecognizedPlates' –  Feb 12 '15 at 16:37

1 Answers1

0

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
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523