我正在尝试在文档库中创建一个新文件夹并使用 FileOpenPicker 选择多个图像来保存创建文件夹...
错误是:“System.Collections.Generic.IReadOnlyList”不包含“CopyAsync”的定义,并且没有扩展方法“CopyAsync”接受“System.Collections.Generic.IReadOnlyList”类型的第一个参数(你是缺少 using 指令或程序集引用?)
这是我的代码:
IReadOnlyList<StorageFile> file;
var destinationFolder = await KnownFolders.DocumentsLibrary.CreateFolderAsync("NewFolder", CreationCollisionOption.GenerateUniqueName);
var openpicker = new FileOpenPicker();
openpicker.CommitButtonText = "Upload";
openpicker.FileTypeFilter.Add(".jpg");
openpicker.FileTypeFilter.Add(".jpeg");
openpicker.FileTypeFilter.Add(".png");
openpicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
openpicker.ViewMode = PickerViewMode.List;
file = await openpicker.PickMultipleFilesAsync();
if (destinationFolder != null && file !=null)
{
await file.CopyAsync(destinationFolder);
}