Deserializing a local xml file using Rest Sharp

Viewed 966

I have no problem deserializing an xml into my class while using the following code. I was wondering if it was possible to use the same code on a local file, as our source files are saved locally for archival purposes and are occasionally reprocessed.

This works for remote xml but not for local xml:

RestRequest request = new RestRequest();
var client = new RestClient();

//doesnt work
client.BaseUrl = directory;
request.Resource = file;

//works
client.BaseUrl = baseURL;
request.Resource = url2;


IRestResponse<T> response = client.Execute<T>(request);
return response.Data;

Is there a way to use RestSharp from a local file? I was going to try to use the same function regardless of whether the xml is local or remote and just pass it the location of the xml to read.

2 Answers
Related