How would you delay by 1 minute, the creation of a file generated using C# (.net programming) with VS2010?

zimmer9
zimmer9 used Ask the Experts™
on
Using C# code with VS2010, can you think of a way to allow 1 minute to elapse before creating the file generated in the last statement of the following snippet of code:

foreach (FileInfo file in parentDirectory.GetFiles())
            {
                if (!string.Equals(file.Name, MyGlobals.BASE_FILE_Name + ".ard", StringComparison.InvariantCultureIgnoreCase) &&
                    !string.Equals(file.Name, "Thumbs.db") &&
                    !string.Equals(GetFileTitleOnly(file.Name), GetFileTitleOnly(currentRunningAssembly.ManifestModule.Name), StringComparison.InvariantCultureIgnoreCase))
                {
                    StreamWriter sw1 = new StreamWriter(errorFilePath);
                    ProcessFile(file.FullName, sw1);                                    }
            }

            // allow 1 minute to expire before generating the following file
            File.Open(MyGlobals.BASE_DIR + MyGlobals.BASE_FILE_Name + ".ard", FileMode.Create).Close();
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Architect
Commented:
Before last statement add Thread.Sleep(60000) //in microseconds to allow one minute to expire.
Thread.Sleep(60000);

Open in new window

Just saying, milliseconds, not microseconds :-)
Karrtik IyerSoftware Architect

Commented:
Correct, typo from my end, thanks for correcting Homer :-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial