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

GetLastAccessTime() public method

public GetLastAccessTime ( string path ) : DateTimeOffset
path string
return DateTimeOffset
        public DateTimeOffset GetLastAccessTime(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.GetLastAccessTime(GetFullPath(path)));
            }
            catch (UnauthorizedAccessException)
            {
                return new DateTimeOffset(1601, 1, 1, 0, 0, 0, TimeSpan.Zero).ToLocalTime();
            }
        }

Same methods

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

Usage Example

Esempio n. 1
0
 public void GetLastAccessTime_RaisesArgumentException()
 {
     using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly())
     {
         AssertExtensions.Throws <ArgumentException>("path", null, () => isf.GetLastAccessTime("\0bad"));
     }
 }
All Usage Examples Of System.IO.IsolatedStorage.IsolatedStorageFile::GetLastAccessTime