Database results to Array?
-
I have an interesting situation. I am doing a DB query to lookup email addresses from a SQL server table. I want to then put those addresses into an email to be sent programmatically. So there could be anywhere from 1 to x email addresses. Kind of new to asp.net and was curious as to the communities thoughts on if an array or collection would be better, or something else?
Ben Jones
-
I have an interesting situation. I am doing a DB query to lookup email addresses from a SQL server table. I want to then put those addresses into an email to be sent programmatically. So there could be anywhere from 1 to x email addresses. Kind of new to asp.net and was curious as to the communities thoughts on if an array or collection would be better, or something else?
Ben Jones
I would say use System.Collections.Specialized.StringCollection This is a specialized collection of strings.. Or you can use System.Collections.Generic.List i.e. System.Collections.Generic.List myList = new System.Collections.Generic.List(); If you know the exact number of results, array is just raw memory and fastest too, whereas using these above data structures requires some overhead..
Author, SharpDeveloper.NET
-
I would say use System.Collections.Specialized.StringCollection This is a specialized collection of strings.. Or you can use System.Collections.Generic.List i.e. System.Collections.Generic.List myList = new System.Collections.Generic.List(); If you know the exact number of results, array is just raw memory and fastest too, whereas using these above data structures requires some overhead..
Author, SharpDeveloper.NET