-1
StrManagers = string.Empty;

foreach (Manager manager in Managers)
{
 StrManagers = manager.Name + "</br>";
}

How can I achieve this using Linq?

Gopi
  • 5,316
  • 20
  • 74
  • 136

1 Answers1

4

You could use the String.Join method:

String.Join("</br>", Managers.Select(manager => manager.Name));
Christos
  • 52,021
  • 8
  • 71
  • 105
  • Doesn't it join Manager instead of Manager.name? – Gopi Apr 27 '15 at 11:51
  • This will join the names of the managers. Actually, this `Managers.Select(manager => manager.Name)` defines a sequence of the manager names. – Christos Apr 27 '15 at 11:52