C# 获得目录创建时间,在这段代码中先创建一个目录,获取创建时间后,将目录删除
using System; using System.IO; class DirectoryCreationTime { public static void Main() { string directoryString = Directory.GetCurrentDirectory() + @"\TestDir"; Directory.CreateDirectory (directoryString); DateTime dateTime = Directory.GetCreationTime (directoryString); Console.WriteLine("Creation time: {0}", dateTime); Directory.Delete (directoryString); } }