Please consider the following:
public class MyObject
{
public bool B;
public string Txt;
}
List<MyObject> list; //list of a bunch of MyObject's
With lambda expression, how can I produce a string consisting of comma separated values of Txt of those objects, where B is true?
for .net 3.5:
string.Join(",", list.Where(o => o.B).Select(o => o.Txt).ToArray())
for .net 4.0:
string.Join(",", list.Where(o => o.B).Select(o => o.Txt))