Пример #1
0
 public static void SaveJson <T>(this VirtualFile file, T value)
     where T : class
 {
     try
     {
         using (Stream stream = file.OpenCreate())
             using (StreamWriter sr = new StreamWriter(stream))
             {
                 JsonSerializer xs = new JsonSerializer();
                 xs.Serialize(sr, value, typeof(T));
             }
     }
     catch (Exception ex)
     {
         // do nothing
     }
 }