In continuation to blog posts in this series on plugins, today we’ll cover a plugin/library to perform FileIO.
There are different APIs on different platforms to perform FileIO. Having said that, Xamarin already makes life easier by implementing System.IO which is available in Android and iOS.
Following code can be used in Android to create a file and then read contents from it.
Similarly, following code can be used in case of iOS application.
In case of Windows, using WinRT APIs, the case is little bit different as shown below:
Now to make life easier, there is a NuGet from Daniel Plaisted, which can help you to use same code on different platforms. You can find more information about the library from here: https://www.nuget.org/packages/PCLStorage/
This way, you can use one code (in C#) across all the three different platforms.
Hope you’re enjoying this series. Do let me know your feedback if you want to include any specific libraries/features.
Namaste
Mayur Tendulkar