var eyedropper = new Eyedropper();
var color = await eyedropper.Open();
it gives
Error CS4033 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. EyesDrpperApp
Document Details
using Microsoft.Toolkit.Uwp.UI.Controls;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace EyesDrpperApp
{
///
/// An empty page that can be used on its own or navigated to within a Frame.
///
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
Load();
}
private void Load()
{
var eyedropper = new Eyedropper();
var color = await eyedropper.Open();
}
}
}
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
ID: 602dca82-3de3-094e-e695-aa728f8b6fda
Version Independent ID: 92466d8c-0ad9-3c7c-c706-f85232a5849d
There is something missing in the code examples:
var eyedropper = new Eyedropper(); var color = await eyedropper.Open();
it gives Error CS4033 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. EyesDrpperApp
Document Details
using Microsoft.Toolkit.Uwp.UI.Controls; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace EyesDrpperApp { ///
/// An empty page that can be used on its own or navigated to within a Frame.
///
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
Load();
}
}
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.