Most Recent File From Directory - C#

Most Recent File From Directory - C#

code snippet

c#
var directory = new DirectoryInfo("C:\\path-to-directory");
var myFile = directory.GetFiles("*.txt")
             .OrderByDescending(f => f.LastWriteTime)
             .First();

"The measure of who we are is what we do with what we have"

Contact me!

Have questions? Feel free to use the form or send me an email with any questions.

I will be responsive to your requests and your questions.