You have a ;
at the end of your foreach, which means s
is not in the scope when you add it to poruka
. Change it to be like this:
foreach (string s in textBox1.Text.Split())
{
poruka.To.Add(s);
}
This is the reason I, personally, always like to use braces and not inline my foreach's.