I got the following code :
foreach (string file in Directory.GetFiles(generationDir, "*.xaml")
{
File.Delete(file);
}
foreach (string file in Directory.GetFiles(generationDir, "*.cs")
{
File.Delete(file);
}
I’d like to merge these 2 foreach in a single loop ? Is that possible ?
I’m not comfortable with lambda expression so got a hard time here…
For those who like
ForEach()“sequence operator fake” 🙂(Please be aware of “foreach” vs “ForEach” before usign it)
If you are usign .NET Framework v4 you can use more efficient Directory.EnumerateFiles() method: