Is a DataTable good for this situation? Or should I use some other Data structure?

I'm setting up a group email function on an ASP.NET C# web app. I have everything programmed and working but I want to verify that I'm using the proper data structure to hold the emails.

Details:

Emails are stored in a SQL database table. There are two columns Email1 and Email2. I have a query that merges the two columns and puts it into one column (Emails) and omits any that are NULL, this data is returned to my C# code and placed in a DataTable. I then use the datatable like so to add the email address to the email BCC:

foreach(DataRow row in dt.Rows) { msg.Bcc.Add(row["Emails"]); } 

The number of email addresses various greatly because each staff member belongs to different emailing groups and some groups have 40 and some have 300 email addresses.

Is this the best way of doing it or should I use a different data structure?

by barcode0527 via /r/csharp

Leave a Reply