Home > Net >  Using c # foreach every time how to get the first file, rather than the latest
Using c # foreach every time how to get the first file, rather than the latest

Time:05-28

Directory under ABC, every few seconds TXT file can be generated in the program foreach (var file in files) files is defined as a *. TXT, but foreach every time to obtain the file is the latest in (to), rather than the first, how to solve?

CodePudding user response:

List SSSS=s.O rderBy (ss=& gt; New to the FileInfo (ss). CreationTime). ToList ();
  •  Tags:  
  • C#
  • Related