Hi all I have a weird optimization question, here is the code I have changed some names for simplicity
CollectionObject mycollobj = new CollectionObject();
List<string> MyProducts = new List<string>();
//get collection of selected customers that were passed in
var chckedValues = form.GetValues("assignChkBx");
foreach(string customer in chckedValues )
{
MyProducts.Clear();
//MyProducts is then set to a data access method in my data access class
MyProducts = DataLayerClass.GetProductsFromCustomer(customer);
foreach(string product in MyProducts)
{
string item1 = DataLayerClass.GetItem1(product);
string item2 = DataLayerClass.GetItem2(product);
mycollobj.loaditems(item1, item2);
}
}
Essentially mycollobj is a black box that is used for some fairly involved analysis (that I have no control over). Is there any better way to run this nested algorithm? Any suggestions are valued and please ask if you need clarification on anything. Thanks!
mycollobj.loaditemsis the slow part, can you move that call to a background thread?