如何从指定位置读取文件并转换为Xamarin形式的流

时间:2018-11-09 15:50:18

标签: xamarin.forms filestream

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

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

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

找不到文件异常,但是文件在该位置。

1 个答案:

答案 0 :(得分:0)

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