【发布时间】:2015-03-12 21:15:39
【问题描述】:
我正在尝试在我的类库中创建一个 StorageFile 实例...
var localFolder = ApplicationData.Current.LocalFolder;
StorageFile destinationFile = await localFolder.CreateFileAsync(destination, CreationCollisionOption.GenerateUniqueName);
VS11 没有构建说:'await' 要求类型 'Windows.Foundation.IAsyncOperation' 具有合适的 GetAwaiter 方法。您是否缺少“系统”的 using 指令?
显然,我使用 .net 4.5 作为目标,并且我正在引用 Windows 程序集... 不知道为什么这段代码可以在 MetroStyle 中工作,但不能在类库中构建......如何在类库中创建 Storagefile 的实例?在这个阶段,是否以异步方式创建文件并不重要......
请告诉我你的想法... 斯特里奥
【问题讨论】:
-
在 Metro 风格中,代码文件顶部是否有额外的 using 语句?
标签: c# windows-8 windows-runtime isolatedstorage async-await