System.IO.File.SetLastWriteTime C# (CSharp) Méthode

SetLastWriteTime() public static méthode

public static SetLastWriteTime ( String path, DateTime lastWriteTime ) : void
path String
lastWriteTime DateTime
Résultat void
        public static void SetLastWriteTime(String path, DateTime lastWriteTime)
        {
            String fullPath = Path.GetFullPath(path);
            FileSystem.Current.SetLastWriteTime(fullPath, lastWriteTime, asDirectory: false);
        }

Same methods

File::SetLastWriteTime ( string path, System lastWriteTime ) : void

Usage Example

Exemple #1
0
        private void ClearOnFailingToCompile(string dllPathFile, string modelsHashFile, string projFile)
        {
            _logger.Debug <PureLiveModelFactory>("Failed to compile.");

            // the dll file reference still points to the previous dll, which is obsolete
            // now and will be deleted by ASP.NET eventually, so better clear that reference.
            // also touch the proj file to force views to recompile - don't delete as it's
            // useful to have the source around for debugging.
            try
            {
                if (File.Exists(dllPathFile))
                {
                    File.Delete(dllPathFile);
                }
                if (File.Exists(modelsHashFile))
                {
                    File.Delete(modelsHashFile);
                }
                if (File.Exists(projFile))
                {
                    File.SetLastWriteTime(projFile, DateTime.Now);
                }
            }
            catch { /* enough */ }
        }
All Usage Examples Of System.IO.File::SetLastWriteTime