title: SSIS ForEach From Variable Enumerator, list created with C# - The object in the variable does not contain an enumerator
body: <p>I've been chipping away at refactoring an SSIS package that copies a pile of log files into a folder on our network, examines all of the files in the destination folder and then deletes any that have aged past our retention policy. It seems like it should all work but for the error above.</p>
  
  <p>Outline:
  Variable "dailyFilesToDelete" of type Object, populated by a script task inside a ForEach File Loop. 
  I simplified my code to add a single file that I created to test this new package with and try to get to the heart of the issue.</p>
  
  <pre><code>var fileListDelete = new List&lt;string&gt;();
  fileListDelete.Add(@"Q:\xpcttvcpc_live_Full_201912050000.bak");
  Dts.Variables["dailyFilesToDelete"].Value = fileListDelete.GetEnumerator();
  Dts.TaskResult = (int)ScriptResults.Success;
  </code></pre>
  
  <p>The next step is the Foreach Loop that is failing.</p>
  
  <p>Enumerator: Foreach From Variable Enumerator</p>
  
  <p>Enumerator variable: User::dailyFilesToDelete</p>
  
  <p>Variable mapping: User::deleteFileName</p>
  
  <p>I suspect that the issue is with how I'm passing my list of strings into dailyFilesToDelete. I initially was passing in the List itself, and once I saw the "variable does not contain an enumerator" error I was sure that adding the GetEnumerator call would fix it.</p>