I'm studying DDD and WebAPI and as I find it difficult, I'm researching and trying to solve it. Of course, sometimes I come across simple things for some here and I can not solve them right away.
Sometimes I even understand what has to be done, but I do not know how to do it, as is the case now. With Console project, I did, but I switched to a Windows Form and am having this difficulty.
I need to populate a ListBox, as a result of a Foreach lambda resulting from a list of a Predicate. The question is in ForEach, like this:
private void button1_Click(object sender, EventArgs e)
{
string[] teste = new string[] { "um", "dois", "tres", "quatro", "cinco" };
Predicate<string> p = objetoTeste => objetoTeste.Length >= 4;
var i = from items in teste
where (p(items))
select (items);
i.ToList().ForEach(listBox1.Items.Add()**==>> Dúvida aqui**);
/*foreach (var item in teste)
{
listBox1.Items.Add(item);
}*/
}
The question is how to call ListBox1.Items.Add()
and fill it in foreach