I have a method in my app that populates DataTable
with the data using the following code:
DataTable dt = this.attachmentsDataSet.Tables["Attachments"];
foreach (Outlook.Attachment attachment in this.mailItem.Attachments)
{
DataRow dr = dt.NewRow();
dr["Index"] = attachment.Index;
dr["DisplayName"] = String.Format(
CultureInfo.InvariantCulture,
"{0} ({1})",
attachment.FileName,
FormatSize(attachment.Size));
dr["Name"] = attachment.FileName;
dr["Size"] = attachment.Size;
dt.Rows.Add(dr);
}
I was wondering if I could achieve the same functionality using LINQ in order to shorten this code a bit. Any ideas?