コンパイル エラーがいくつか発生します。理由がわかりません。何が間違っているのでしょうか。
static void Main(string[] args)
{
DriveInfo[] drives = DriveInfo.GetDrives();
foreach (DriveInfo drive in drives)
{
Menu startMenu = new Menu() { Title = "Enter a drive" };
// The error is here: Invalid initializer member declarator
MenuItem d = new MenuItem() {Text = "{0}" , drive.Name};
if (drive.IsReady)
{
Console.CursorLeft = 5;
Console.Write(drive.VolumeLabel);
}
// another error: 'System.IO.DriveInfo' does not contain a definition for 'Selected' and no extension method 'Selected' accepting a first argument of type 'System.IO.DriveInfo' could be found (are you missing a using directive or an assembly reference?)
drive.Selected += drive_Selected;
startMenu.Items = new[] {d};
startMenu.Show();
}
}
private static void drive_Selected()
{
}