I guess this is easy, but I am new and cannot find a fast answer to this:
I want to obtain a list of file names (List<string>
) in a .Net 2.0 desktop app, using WebClient requesting to a WebAPI REST service.
So, I have this code in the desktop app:
using (var client = new WebClient())
{
client.Headers[HttpRequestHeader.Accept] = "application/json";
var resultString = client.DownloadString("http://localhost:3788/api/file?src=X&dest=Y");
}
and a WebAPI action like this in the service:
public IEnumerable<string> GetFiles([FromUri]string src, [FromUri]string dest)
{
// some code here
}
How would I convert the resultString
, which is a JSON String
, to a List<String>
?
Do I have to use JsonDataContractSerializer
?