Xamarin.Forms: Directory.GetFiles
Xamarin.Forms: Directory.GetFiles
我正在开发 Xamarin Forms 应用程序。我想做的是从 certian 服务器目录中获取生命。这种代码和平将适用于大多数 .NET 应用程序。
public static string[] GetFiles
{
string[] filePaths = Directory.GetFiles("www.site.com/files");
}
但是目录 class 在 Xamarin 的 System.IO 中不存在。还有其他方法吗?
PCL不支持大多数直接文件I/O类,因为WindowsPhone只支持文件I/O的IsolatedStoarge .
您可以使用 DependencyService to inject platform specific file I/O into your Forms app, or look at PCL-friendly file I/O packages like PCLStorage。
我正在开发 Xamarin Forms 应用程序。我想做的是从 certian 服务器目录中获取生命。这种代码和平将适用于大多数 .NET 应用程序。
public static string[] GetFiles
{
string[] filePaths = Directory.GetFiles("www.site.com/files");
}
但是目录 class 在 Xamarin 的 System.IO 中不存在。还有其他方法吗?
PCL不支持大多数直接文件I/O类,因为WindowsPhone只支持文件I/O的IsolatedStoarge .
您可以使用 DependencyService to inject platform specific file I/O into your Forms app, or look at PCL-friendly file I/O packages like PCLStorage。