Zac Gross

Code & More

File Parameter Support for Portable Restsharp Library

| Comments

When developing mobile cross platform apps with Xamarin I like to keep as much common code as possible in a shared portable class library (PCL) for easy reuse. This includes any webservice calls and the associated boilerplate code. I have been using a fork of the Restsharp library which has been modified to be PCL compliant. This strategy was working fine until recently when I needed to start uploading files through webservices. The Restsharp library has robust file upload support but because it is often tied to OS specific file operations it was left out of the PCL port. As a work around I simply imported the necessary file upload code from the original library using raw bytes and streams as interfaces rather than filenames. Leaving it up to the caller to implement the file loading in their native OS code.

My fork can be found on github at: https://github.com/zacg/geoserver-csharp

Comments