1

I'm new in UWP application development and I want to create folder using LocalStorage so I have something like:

private static StorageFolder _settingsFolder = Windows.Storage.ApplicationData.Current.LocalFolder;

public async static Task<bool> SaveUsers(string file, List<mymodel> data)
    {
        try
        {

            StorageFile currentFile = await _settingsFolder.CreateFileAsync("myfile.json", CreationCollisionOption.ReplaceExisting);

 
            return true;
        }
        catch
        {
            return false;
        }
    }

but it just throw an error:

'IAsyncOperation' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'IAsyncOperation' could be found (are you missing a using directive for 'System'?)

I read another questions about GetAwaiter issue but I can not found a fix to this. Regards

Jesus
  • 79
  • 2
  • 9
  • 1
    Does this answer your question? [FromBluetoothAddressAsync IAsyncOperation does not contain a definition for 'GetAwaiter' error](https://stackoverflow.com/questions/44099401/frombluetoothaddressasync-iasyncoperation-does-not-contain-a-definition-for-get) – Etienne de Martel Jul 21 '20 at 23:28
  • Hello, your code looks ok. Are you missing the necessary references? You can delete the `bin` and `obj` folders in the project and rebuild the project – Richard Zhang Jul 22 '20 at 01:33
  • Are you sure that this error refers to that piece of code? – Luca Lindholm Jul 22 '20 at 02:01

1 Answers1

0

You should write using System; at the the top of the file.

Vincent
  • 3,124
  • 3
  • 21
  • 40