可以考虑用DateTime.ToFileTime 方法,
该值为自 1601 年 1 月 1 日午夜 12:00 以来所经过时间以 100 毫微秒为间隔表示时的数字。

解决方案 »

  1.   

    DateTime.Now.ToLongDateString()+"\\"+DateTime.Now.ToLongTimeString()+"\\"+Guid.NewGuid().ToString()+".ext"
      

  2.   

    >>>之前如何判断目录是否已经存在?
    use System.IO.Directory.Exists("YourDirPath")>>>遇到文件名已经存在。就累加1如何操作?
    if those files are only created by your application, consider something like:lock something so only one instance of your application or thread can access
      search for the file name whose last four digits are the largest
      add 1 to the number
      create the new file with the new number 
    unlock the thing you locked earlierdepending on what you are doing and how you are doing it, you can use Monitor, Mutex, ...or do an exclusive open on an existing file to do the locking
      

  3.   

    1.Directory.Exists
    2.DateTime.Now.ToFileTime() + user ID
      

  4.   

    看我的,我想不可能重复吧:)
    DateTime now = DateTime.Now;
    string TimeTag = now.Year.ToString() + now.Month.ToString() + now.Day.ToString() + now.Hour.ToString() + now.Minute.ToString() + now.Second.ToString() + now.Millisecond.ToString() + now.DayOfYear.ToString();
    string UploadFileName = TimeTag.ToString() + filename.PostedFile.ContentLength.ToString() + "_" + 文件名;