System.IO.IsolatedStorage.IsolatedStorageFile.GetLastWriteTime C# (CSharp) Method

GetLastWriteTime() public method

public GetLastWriteTime ( string path ) : DateTimeOffset
path string
return DateTimeOffset
        public DateTimeOffset GetLastWriteTime(string path)
        {
            if (path == null)
                throw new ArgumentNullException(nameof(path));

            if (path == string.Empty)
            {
                throw new ArgumentException(SR.Argument_EmptyPath, nameof(path));
            }

            EnsureStoreIsValid();

            try
            {
                return new DateTimeOffset(File.GetLastWriteTime(GetFullPath(path)));
            }
            catch (UnauthorizedAccessException)
            {
                return new DateTimeOffset(1601, 1, 1, 0, 0, 0, TimeSpan.Zero).ToLocalTime();
            }
        }

Same methods

IsolatedStorageFile::GetLastWriteTime ( string path ) : System.DateTimeOffset

Usage Example

Esempio n. 1
0
 public void GetLastWriteTime_RaisesArgumentException()
 {
     using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly())
     {
         Assert.Throws<ArgumentException>(() => isf.GetLastWriteTime("\0bad"));
     }
 }
All Usage Examples Of System.IO.IsolatedStorage.IsolatedStorageFile::GetLastWriteTime