Azavea.NijPredictivePolicing.Common.FileUtilities.TryChangeLastWriteTime C# (CSharp) Method

TryChangeLastWriteTime() public static method

Try changing the file's last write time without exceptions. Returns true on success, false on failure.
public static TryChangeLastWriteTime ( string filename, System.DateTime newTime ) : bool
filename string
newTime System.DateTime
return bool
        public static bool TryChangeLastWriteTime(string filename, DateTime newTime)
        {
            try
            {
                if (File.Exists(filename))
                {
                    File.SetLastWriteTime(filename, newTime);
                }

                return true;
            }
            catch { }
            return false;
        }