I have been working on some code and started using Tuple just to hold some data for a bit until some other functions are processed and then I use the Tuple in list to grab some information from it and send an email, for instance:
List<Tuple<Customer, Contact, Product>> tupleInfo =
new List<Tuple<Customer, Contact, Product>>();
Then i add the different objects to it by calling a method where I pass Customer, Contact and Product:
Tuple<Customer, Contact, Product> info =
new Tuple<Customer, Contact, Product>(myCustomer, myContact, myProduct);
info.Add(info);
At the end after I process all my stuff in other methods this list will endup with a maximum of 10 tuples that I then send to a method that sends an email, something like this:
private ActionResult SendEmails(List<Tuple<Customer, Contact, Product> list)
{
ActionResult result = new ActionResult;
foreach(Tuple<Customer, Contact, Product> info in list)
{
//Here i just grab some the information
//from each tuple, email, product,contact
//contact info and customer info and send
//a personalized email, then do the same with the next records
}
return result;
}
My question is, how efficient is this, is it ok to use Tuples this way?, am I trading performance by using Tuples?
I am new using this so would like to know before I do it the wrong way.