首页 > 代码库 > 循环删除集合里的值

循环删除集合里的值

   1:   List<string>.Enumerator enumerator = files.GetEnumerator();
   2:   while (enumerator.MoveNext())
   3:   {
   4:       if (File.Exists(enumerator.Current))
   5:       {
   6:           File.Delete(enumerator.Current);
   7:       }
   8:   }
<style type="text/css">.csharpcode, .csharpcode pre{ font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/}.csharpcode pre { margin: 0em; }.csharpcode .rem { color: #008000; }.csharpcode .kwrd { color: #0000ff; }.csharpcode .str { color: #006080; }.csharpcode .op { color: #0000c0; }.csharpcode .preproc { color: #cc6633; }.csharpcode .asp { background-color: #ffff00; }.csharpcode .html { color: #800000; }.csharpcode .attr { color: #ff0000; }.csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em;}.csharpcode .lnum { color: #606060; }</style>