Forum Cross Platform with Xamarin
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

File Handling (Android and IOS)


I am currently working on a book management for Android and IOS. I would like to create a CSV file with the current stock and save it. My question is how do I find a path for Android and IOS where I can write and read?


  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Xamarin Essentials includes file system helpers

  • LTBLTB Member ✭✭
        private void FileGeneratorClicked(object sender, EventArgs e)
            string date = DateTime.Now.ToString("dd.MM.yyyy");
            string name = "Lagerstand vom " + date + ".xls";
            var location = FileSystem.AppDataDirectory;
            string path = Path.Combine(location, name);
            List<List<string>> data = new List<List<string>>()
                new List<string> { "AWL", "987-5-417-1", "6" },
                new List<string> { "DTSM", "362-0-258-9", "63"},
            if (Directory.Exists(location))
            File.WriteAllText(name, createHTMLTable(data));
        public static string createHTMLTable(List<List<string>> data)
            StringBuilder sb = new StringBuilder("<table>\r\n");
            foreach (List<string> row in data)
                foreach (string col in row)
                    sb.AppendLine("<td>" + col + "</td\r\n>");
            return sb.ToString();
  • LTBLTB Member ✭✭

    It comes a Win32Exception

Sign In or Register to comment.