1
我想在try块中检查我的db文件存在,并在catch中创建它。为什么我在使用C#的Windows Phone 8中获取FileNotFoundException?
public async Task<bool> CheckDbAsync()
{
bool dbExist = true;
try
{
StorageFile sf = await ApplicationData.Current.LocalFolder.GetFileAsync(DB_NAME);
}
catch(FileNotFoundException)
{
Conn = new SQLiteAsyncConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path,"baby.db") , true);
dbExist = false;
}
return dbExist;
}
问题是我得到相同的处理异常。代码在我的try块中断。任何想法为什么?
@ RenDishen。我无法使用TryGetItemAsync。得到错误 “windows.storage.storgaefolder不包含TryGetItemAsync的定义” – 2014-10-21 08:37:55