Here is my question: I have some code that is duplicated and I want to put to one function and call that function whenever needed. The code uses to List<objects> that pull from the database. Well I do not want to hit the database everytime this function
is called, so I was thinking about passing the list of the tables in the database as reference. Well one of them works, but the other one has an error like the below. Is there a way around this or am I doing this wrong? This function might get called in a
foreach() loop for every user, so I don't want to hit the database 40 times when I can hit it once and pass that list<object> into my function and use that. Of course if I pass by value, then my understanding is, it will create a new copy of that in memory
which kinda also defeats the purpose. I am not hitting the database, but taking up memory etc.
Error: Cannot use ref or out parameter 'myListObject' inside an anonymous method, lambda ...
Go to the complete details ...