C# 无法隐式转换类型';Windows.Storage.StorageFile';至';布尔';

C# 无法隐式转换类型';Windows.Storage.StorageFile';至';布尔';,c#,windows-phone-8.1,C#,Windows Phone 8.1,当我在这段代码中返回“FileExist”varable时,我得到了一个错误 public static async Task<bool> FileExistsForWp8(string filename) { StorageFolder folder = Windows.Storage.ApplicationData.Current.LocalFolder; try { Stor

当我在这段代码中返回“FileExist”varable时,我得到了一个错误

public static async Task<bool> FileExistsForWp8(string filename)
    {
        StorageFolder folder = Windows.Storage.ApplicationData.Current.LocalFolder;            
        try
        {
            StorageFile FileExists = await folder.GetFileAsync(filename);
            return FileExists;
        }
        catch (Exception ex)
        {
            return FileExists;
        }
    }
公共静态异步任务文件existsforwp8(字符串文件名)
{
StorageFolder folder=Windows.Storage.ApplicationData.Current.LocalFolder;
尝试
{
StorageFile FileExists=等待文件夹.GetFileAsync(文件名);
返回文件存在;
}
捕获(例外情况除外)
{
返回文件存在;
}
}
返回一个

这是:

public static async Task<bool> FileExistsForWp8(string filename)
{
    StorageFolder folder = Windows.Storage.ApplicationData.Current.LocalFolder;  
    try
    {
       StorageFile File = await folder.GetFileAsync(filename);
       return true;
    }
    catch
    {
        return false;
    }
}
公共静态异步任务文件existsforwp8(字符串文件名)
{
StorageFolder folder=Windows.Storage.ApplicationData.Current.LocalFolder;
尝试
{
StorageFile File=wait folder.GetFileAsync(文件名);
返回true;
}
抓住
{
返回false;
}
}

我想您在try块中的意思是“return true”,在catch中的意思是“false”。您希望返回一个布尔值。我会尝试使用“return true”和“return false”方法返回类型为Task,但您正在尝试返回Task