static void Main(string[] args) { DBdel del = Fetch.AddToDB; //Fetch.GetJson(del, "https://api.openweathermap.org/data/2.5/weather?q=Atlanta&units=imperial&appid=e312dbeb8840e51f92334498a261ca1d"); Calculator.Run(); //SayHello(); //MyDel del = SayHello; //del(); }
public static void GetJson(DBdel del, string apiUrl) { WebRequest webRequest = WebRequest.Create(apiUrl); WebResponse webResponse = webRequest.GetResponse(); StreamReader reader = new StreamReader(webResponse.GetResponseStream()); string jsonAsString = reader.ReadLine(); while (jsonAsString != null) { Console.WriteLine(jsonAsString); jsonAsString = reader.ReadLine(); } del(); }