| 123456789101112131415161718192021222324252627 |
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Fuel01
- {
- public static class Utils
- {
- public static bool SaveToJson<T>(string filename, T ds)
- {
- try
- {
- var result = JsonConvert.SerializeObject(ds,Formatting.Indented);
- File.WriteAllText(filename, result);
- return true;
- }
- catch
- {
- return false;
- }
- }
- }
- }
|