Nathan McKaskle Nathan McKaskle - 1 year ago 108
C# Question

Converting an Object List to a String List

What's a better way to write the following? Can I do it with a Lambda expression?

List<string> managerList = new List<string>();
foreach (Manager m in matchedManager)

Answer Source

Yes you can use LINQ. Like this:

List<string> managerList = matchedManager.Select(m => m.FullName).ToList();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download