John
John

Reputation: 75

c# uwp read csv from web

I am trying to make an app that make use of open data. The data I try to read out is in a CSV format (and is about 40mb big).

I have 2 problems I can't solve.

I am a newbie in UWP (c#) applications, so my apologies for the questions.

Thanks in advance.

Upvotes: 1

Views: 497

Answers (1)

Martin Zikmund
Martin Zikmund

Reputation: 39092

There are two APIs you can use to download a file. One is HttpClient, described here on MSDN Documentation and in a UWP sample here. This class is usually recommended for smaller files and smaller data, but can easily handler larger files as well. Its disadvantage is, that when the user closes the app, the file will stop downloading.

The alternative is BackgroundDownloader, again here on MSDN and here in UWP samples. This class is usually recommended for downloading larger files and data, as it automatically perfroms the download in the background so the download will continue even when the app is closed.

To store your files, you can use the ApplicationData.Current.LocalFolder. This is a special folder provided to you by the system for storage of application files. You have read/write access to this folder and you can not only store your files here, but even create subfolder structure using UWP StorageFile and StorageFolder APIs. More about this is on MSDN.

Upvotes: 1

Related Questions