public async Task SaveStatus(DAL.DAO.Status status) { string json = JsonConvert.SerializeObject(status); //write string to file await System.IO.File.WriteAllTextAsync(fileName, json); }
static async System.Threading.Tasks.Task Main(string[] args) { RegisterServices(); ITwitterService TwitterService = serviceProvider.GetService <ITwitterService>(); DAL.DAO.Status status = new DAL.DAO.Status(); while (true) { // service - like process Console.WriteLine("Reading Sample Stream...."); await TwitterService.ReadTweets(status); Console.WriteLine("Connection Closed / Reconnecting....."); } }