Skip to content

Instantly share code, notes, and snippets.

@manojkulkarni30
Created January 27, 2018 16:00
Show Gist options
  • Save manojkulkarni30/05c29e5ebd74722c7fb7d4faf7866f19 to your computer and use it in GitHub Desktop.
Save manojkulkarni30/05c29e5ebd74722c7fb7d4faf7866f19 to your computer and use it in GitHub Desktop.
SQLite Connection In Xamarin

Android

string path = System.Environment.GetFolderPath(
    System.Environment.SpecialFolder.Personal);
return System.IO.Path.Combine(path, filename);

iOS

string docFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string libFolder = System.IO.Path.Combine(docFolder, "..", "Library");

if (!System.IO.Directory.Exists(libFolder)) {
    System.IO.Directory.CreateDirectory(libFolder);
}

return System.IO.Path.Combine(libFolder, filename);

Windows

string path = global::Windows.Storage.ApplicationData.Current.LocalFolder.Path;
return System.IO.Path.Combine(path, filename);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment