/// <summary> /// Get the latest RSS for all the URLs in the dictionary. /// </summary> private static void Update() { foreach (string url in dictionary.Keys) { // For simplicity, so this synchronously, single-threaded and // without error handling. var response = new StreamReader(WebRequest.Create(url).GetResponse().GetResponseStream()); dictionary[url] = new RssFeedData { LastRetrieved = DateTime.UtcNow, Data = response.ReadToEnd(), }; } }
/// <summary> /// Add the specified urls to the RSS dictionary. /// </summary> /// <param name="urls">Urls to add.</param> private static void Add(string[] urls) { foreach (string url in urls) { // Don't overwrite an existing entry if (!dictionary.ContainsKey(url)) { dictionary[url] = new RssFeedData { LastRetrieved = null, Data = String.Empty, }; } } }