Monday

linq concatenate rows

we can use Aggregate methods to concatenate fields in rows as follow:

var profiles = (from b in invoiceContext.bills
join p in invoiceContext.PaymentProfiles on 1 equals 1
where b.ProfileID == p.Id || b.ProfileType == p.Id
select p.Name).ToList();

if (profiles.Count() > 0)
{
BillingMethodLabel.Text = profiles.Aggregate((current, next) => current + ", " + next);
}


No comments:

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...