当前上下文中不存在名称 'Directory'

The name 'Directory' does not exist in the current context

我创建音乐播放器,因为我正在学习如何编写通用应用程序。我正在尝试加载文件夹中所有歌曲的列表,但是当我使用 GetFiles 时,Visual Studio 向我显示错误:“

The name 'Directory' does not exist in the current context"

即使在代码的开头我有 "using System.IO"。我做错了什么?

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace project_2
{

    public sealed partial class Select : Page
    {
        private void add_new_song(int song_number)
        {...}

        private string[] load_songs()
        {
            string[] paths = Directory.GetFiles(@"C:\");
        }

        public Select()
        {...}

        private void GridView_ItemClick(object sender, ItemClickEventArgs e)
        {...}

    }
}

Directory 不是商店应用程序 SDK 的一部分,即使它 GetFiles 也不存在,因为 SDK 中没有同步方法来访问光盘资源。

您可能正在寻找 StoreageFolder.GetFilesAsync 或类似的 API...