static IWeatherService GetWeatherService(WeatherServiceType type) { switch (type) { case WeatherServiceType.WeatherUnderground: return new WeatherUndergroundService("e7fe61b98ca8b216", "Latvia", "Riga"); default: return new FakeWeatherService(); } }
static IWeatherService GetWeatherService(WeatherServiceType type) { switch (type) { case WeatherServiceType.WeatherUnderground: return(new WeatherUndergroundService("e7fe61b98ca8b216", "Latvia", "Riga")); default: return(new FakeWeatherService()); } }
/// <summary> /// Factory method /// </summary> /// <param name="type">The type of WeatherDataService desired</param> /// <returns>A class that implements IWeatherDataService</returns> public static IWeatherDataService GetWeatherDataService(WeatherServiceType type) { switch (type) { case WeatherServiceType.OpenWeatherMap: return(OpenMapDataService.Instance); default: throw new WeatherDataServiceException("unsupported factory type"); } }