Tuesday, July 14, 2009

Check List Box With LINQ + Get Checked IDs Comma Separated

var v = (from b in chkListBuilding.CheckedItems.Cast<listitem>()
select b.Value.ToString());

string BuildingIDs = v.Aggregate(delegate(string item1, string item2)
{
return string.Format("{0}, {1}", item1, item2);
});

No comments: