I try to write a class with method that uses some awaitable operations. This condition makes me define this method as async. But I can't return non-void value from this method. BitmapImage in my case. Here's the code
public sealed class Thumbnailer
{
public async BitmapImage GetThumbImageFromFile(StorageFile sourceFile)
{
StorageItemThumbnail thumb = await sourceFile.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode.PicturesView, 600, Windows.Storage.FileProperties.ThumbnailOptions.UseCurrentScale);
IRandomAccessStream thumbStream = thumb;
BitmapImage thumbPict = new BitmapImage();
thumbPict.SetSource(thumbStream);
return thumbPict;
}
}
How to fix this?