c# - Cannot cast IStorageItem to StorageFile -
the following code not compile because isoftype not accepted method on item. documentation states: when method completes successfully, returns istorageitem represents specified file or folder. if specified file or folder not found, method returns null instead of raising exception. to work returned item, call isoftype method of istorageitem interface determine whether item file or folder. cast item storagefolder or storagefile. can me please? private async void restoredata(string filename) { storagefolder folder = applicationdata.current.localfolder; var item = folder.trygetitemasync(filename); if (item == null) { existingdata = false; } if (item.isoftype(storageitemtypes.file)) { await readdataasync(item storagefile); existingdata = true; } existingdata = false; } thanks... robert you missing await keyword await result of async me