gpt4 book ai didi

c# - 'Windows.Storage.StorageFile File = await FilePicker.PickSingleFileAsync()' 不工作

转载 作者:太空狗 更新时间:2023-10-29 17:30:51 26 4
gpt4 key购买 nike

<分区>

我有以下代码在应用程序中显示文件选取器:

var FilePicker = new Windows.Storage.Pickers.FileOpenPicker();
FilePicker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
FilePicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.ComputerFolder;
FilePicker.FileTypeFilter.Add(".pcs");
FilePicker.FileTypeFilter.Add(".pcp");

Windows.Storage.StorageFile File = await FilePicker.PickSingleFileAsync();

但是,Windows.Storage.StorageFile File = await FilePicker.PickSingleFileAsync() 在编译期间导致此错误:

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

为什么会这样?我从 MSDN 获得了代码。有人可以帮助我吗?

注意:我正在为通用 Windows 编程。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com