public static Attachment[] GetAttachmentsWithoutContents(IDatabaseProvider db, int ticketID) { if (db == null) { throw new ArgumentNullException(nameof(db)); } AttachmentsWithoutContentsTableAdapter tableAdapter = db.DB.AttachmentsWithoutContentsTableAdapter; PeygirDatabaseDataSet.AttachmentsWithoutContentsDataTable rows = tableAdapter.GetDataByTicketID(ticketID); // Create list. List <Attachment> attachments = new List <Attachment>(); foreach (var row in rows) { // Add. Attachment attachment = new Attachment(row); attachments.Add(attachment); } return(attachments.ToArray()); }