Universal vs SilverLight Apps: Verify that a File Exists in Local Storage C#

WindowsPhone Silverlight:
  1. IsolatedStorageFile.FileExists("FileName");  
WindowsPhone Store(WinRT):

In WindowsPhone store 8.1 ,We will use the GetFileAsync function, this function returns the file data if it exists, throwing an exception if it does not exist.
  1. public  static  async Task < bool > FileExists ( this  StorageFolder folder, String filepath)      
  2. {      
  3.     
  4.    #if WINDOWS_APP      
  5.    return  await folder.TryGetItemAsync (filepath)! = null ;      
  6.    #endif      
  7.        
  8.    #if WINDOWS_PHONE_APP      
  9.        
  10. try      
  11. {      
  12.    await folder.GetFileAsync (filepath);      
  13.    return  true ;      
  14. }      
  15. catch    
  16. {      
  17.    return  false ;      
  18. }      
  19.    #endif      
  20. }    
Please read more related beginners tips@ WindowsPhone Tips.