首页 > 解决方案 > 如何从指定位置读取文件并转换为 xamarin 形式的流

问题描述

我已尝试使用以下代码从该位置访问文件并将其转换为流

 string filename = @"D:\ShapeFiles\usa_state.shp";

 FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);

获取文件未找到异常,但该位置存在文件。

标签: xamarin.formsfilestream

解决方案


//Get the file
var path = Path.Combine(FileSystem.CacheDirectory, "usa_state.shp");
var stream = File.OpenRead(path);

推荐阅读