The process of registering is pretty straightforward. But since this is a book, be aware that the UI of newsapi.org might have changed by the time you read this.
OK—let's get that key, as follows:
- Browse to https://newsapi.org/.
- Click Get API key.
- Fill out the form, as illustrated in the following screenshot:
- Copy the API key provided on the next page, as illustrated in the following screenshot:
Now, we need a place to store the key for easy access. We'll create a static class that will hold the key for us. Proceed as follows:
- In the News project, create a new class called Settings in the root folder.
- Add the code as shown in the following snippet, to insert the API key obtained in the preceding section:
namespace News
{
public static class Settings
{
public static string NewsApiKey
{
get
{
return "<Your APIKey here>";
}
}
}
}
The important thing...