find the last modified date of a json file in csharp

Here's a code snippet that uses the FileInfo class from the System.IO namespace to get the last modified date of a JSON file in C#:

main.cs
using System;
using System.IO;

class Program {
    static void Main(string[] args) {
        string filePath = "path/to/file.json";
        FileInfo fileInfo = new FileInfo(filePath);
        DateTime lastModified = fileInfo.LastWriteTime;
        Console.WriteLine("Last Modified Date: " + lastModified);
    }
}
315 chars
12 lines

Replace "path/to/file.json" with the actual file path of the JSON file you want to get the last modified date of. The FileInfo class provides a LastWriteTime property which returns a DateTime object representing the last time the file was modified.

gistlibby LogSnag