In C# you can express a lot using with a minimal set of statements. One of the active goals of the C# team is to keep the language as simple and small as possible. Another (small) example of this is the flexbility of the while statement. Take this snippet of code
string dirName = @"C:\USR";
string fileName = "*.cs";
bool fileMissing = true;
while(fileMissing)
{
fileName = myFiddleFuction(fileName);
fileMissing = Directory.GetFiles(dirName, fileName).Length == 0;
}
This can also be expressed as :
string dirName = @"C:\USR";
string fileName = "*.cs";
do
{
fileName = myFiddleFuction(fileName);
}
while(Directory.GetFiles(dirName, fileName).Length == 0);
The control variable fileMissing, which had to make sure the loop was executed at least once, is gone. If you ever worked with a language like Pascal (Delphi) you'll propably recognize the repeat statement.
Peter