static void Main(string[] args) { WeatherFactory factory = new WeatherFactory(); Location loc = new Location("london", "uk"); IweatherDataService func1 = factory.WeatherService(loc); func1.GetWeatherData(loc, Key); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("hello client"); WeatherFactory factory = new WeatherFactory(); Location l = new Location("london", "uk"); IweatherDataService adi = factory.WeatherService(l); adi.GetWeatherData(l, "4f3cbed25685e619c16d94f45e622782"); }
//use getYouTubeData method to get object that implements IyouTubeDataService interface public IweatherDataService WeatherService(Location loc) { if (loc == null) { return(null); } if (string.Equals(loc.city, "london", StringComparison.OrdinalIgnoreCase)) { IweatherDataService obj = MyUploads.getInstance(); return(obj); } if (!string.Equals(loc.city, "london", StringComparison.OrdinalIgnoreCase)) { throw new WeatherDataServiceException(); } return(null); }