title: Show string list in foreach
body: <p>I created a list of strings with .txt files and then checked if the files exist.</p>
  <p>On top of that I want the tag to show the files the foreach is going through.</p>
  <p>Tried thread.Sleep but the whole app freezes. I am in WPF and the following code I use.</p>
  <pre><code>        private void Button_Click(object sender, RoutedEventArgs e)
          {
              List&lt;string&gt; test = new List&lt;string&gt;();
              test.Add(@&quot;Files\file1.txt&quot;); test.Add(@&quot;Files\file2.txt&quot;); test.Add(@&quot;Files\file3.txt&quot;);
  
              foreach(string t in test)
              {
                  Label2.Content = t;
  
                  System.Threading.Thread.Sleep(1000);
                  if (File.Exists(t))
                  {
                      Label2.Content = &quot;yea!&quot;;
                  }
              }            
          }
  </code></pre>