public async static Task<bool> FileExist(StorageFolder floder, string Filename)
{
try
{
StorageFile sampleFile = await floder.GetFileAsync(Filename);
if (sampleFile != null)
{
return true;
}
else
{
return false;
}
}
catch
{
//出错就报不存在?
//throw new FileNotFoundException();
return false;
}
}
我用以上代码来判断,可是常出现异常。Runtime里面有函数可以判断文件是否存在吗?
让信任简单起来