Skip to content

Commit 395c9f0

Browse files
committed
Add RSS reading example
1 parent 81515c5 commit 395c9f0

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Greetings from Cairo, Egypt. You can [sponsor](https://github.com/sponsors/dodyg
4848
| [Request](/projects/request) | 15 | Form, Cookies, Query String, Headers |
4949
| [Request Timeouts Middleware](/projets/request-timeouts-middleware) | 6 | |
5050
| [Response](/projects/response) | 3 | |
51+
| [RSS](/projects/rss-reader) | 1 | |
5152
| [SignalR](/projects/signalr) | 1 | |
5253
| [Security](/projects/security) | 7 | |
5354
| [Single File Application](/projects/sfa) | 2 | |
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.Net;
2+
using System.Xml;
3+
4+
const string rssUrl = "https://www.newyorker.com/feed/everything";
5+
var xmlDoc = new XmlDocument();
6+
7+
try
8+
{
9+
using (var webClient = new WebClient())
10+
{
11+
var rssData = webClient.DownloadString(rssUrl);
12+
xmlDoc.LoadXml(rssData);
13+
}
14+
15+
Console.WriteLine(xmlDoc.InnerXml);
16+
}
17+
catch (Exception ex)
18+
{
19+
Console.WriteLine("Error loading RSS feed: " + ex.Message);
20+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
</Project>

0 commit comments

Comments
 (0)