Advertisement
pszczyg

Untitled

Apr 28th, 2016
894
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1.         public void Test()
  2.         {
  3.             var numberToBeAdded = 4;
  4.             var listToProcess = new List<int>();
  5.             ProcessList(listToProcess, x=> x + numberToBeAdded);
  6.         }
  7.  
  8.         private void ProcessList(List<int> listToProcess, Func<int,int> processingFunction)
  9.         {
  10.             for (int index = 0; index < listToProcess.Count; index++)
  11.             {
  12.                 var item = listToProcess[index];
  13.                 item = processingFunction(item);
  14.             }
  15.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement