System.IO.FileInfo.MoveTo C# (CSharp) Method

MoveTo() public method

public MoveTo ( string destFileName ) : void
destFileName string
return void
        public void MoveTo(string destFileName) { }
        public System.IO.FileStream Open(System.IO.FileMode mode) { throw null; }

Same methods

FileInfo::MoveTo ( String destFileName ) : void

Usage Example

Example #1
3
 public static void Log(string entry)
 {
     if (console_mode)
     {
         Console.WriteLine(entry);
     }
     StreamWriter writer = null;
     try
     {
         FileInfo info = new FileInfo(fileName);
         if (info.Exists && (info.Length >= 0x100000))
         {
             string path = fileName + ".old";
             File.Delete(path);
             info.MoveTo(path);
         }
         writer = new StreamWriter(fileName, true);
         writer.WriteLine("[{0:yyyy-MM-dd HH:mm:ss}] {1}", DateTime.Now, entry);
         writer.Flush();
     }
     catch (Exception)
     {
     }
     finally
     {
         if (writer != null)
         {
             writer.Close();
         }
     }
 }
All Usage Examples Of System.IO.FileInfo::MoveTo