This does not appear to be a duplicate of the many hundreds of other questions with the same error. I have looked at them all and have found them to be unrelated.
I am making a little note app and am trying to read files from a directory. Following the MSDN example, I have the following code, but it is giving me an Error of:
Error 1 The modifier 'async' is not valid for this item C:\Users\Jase\documents\visual studio 2012\Projects\AppNameHere\AppNameHere\DataModel\AppNameHereDataSource.cs 192 9 AppNameHere
The code I have is:
async public NotesDataSource()
{
StorageFolder documentsFolder = KnownFolders.DocumentsLibrary;
StringBuilder outputText = new StringBuilder();
IReadOnlyList<StorageFile> fileList =
await documentsFolder.GetFilesAsync();
outputText.AppendLine("Files:");
foreach (StorageFile file in fileList)
{
if (file.FileType == "txt")
{
outputText.Append(file.Name + "\n");
}
}
// lots of irrelevant code removed.
}
I don't understand what's going on here. I followed everything to a "T". Can somebody please help?
Thank you!