I'm hoping to find a better way (maybe with a nice linq expression) to convert a string list like "41,42x,43" to a list of valid long's. The below code works, but just feels ugly.
string addressBookEntryIds = "41,42x,43";
var ids = addressBookEntryIds.Split(new[] {',', ';'}, StringSplitOptions.RemoveEmptyEntries);
var addressBookEntryIdList =new List<long>();
foreach (var rec in ids)
{
long val;
if (Int64.TryParse(rec, out val))
{
addressBookEntryIdList.Add(val);
}
}