我已经开始了一个Uni课程,我无法让我了解如何将我的阵列用于开关盒。基本上我只需要开关盒的帮助,然后我可以继续我的工作。 看看到目前为止的样子:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
namespace Assignment2
{
class Program
{
public const int noOfentries = 6;
public const int address = 5;
public static string[,] addressBook = new string[noOfentries, address];//
string array for the address book
public static int deletion;
public static int choice;
public static ConsoleKeyInfo keyPressed;
public static short curItem = 0, c;
public static string[,] menuItems = new string[,]
{
{"Add Entry"},
{"Delete Entry"},
{"Print Book to Screen"},
{"Edit Contact"},
{"Exit"}
};
#region addEntry
#endregion
#region deleteEntry
#endregion
#region seeBook
#endregion
public static void fourthChoice()
{
Console.WriteLine("Would you like to edit the name or address?");
}
public static void menu()
{
for (int i = 0; i < 5; i++)
{
Console.WriteLine(menuItems[i,0].PadRight(10));
Console.Clear();
for (c = 0; c < menuItems.Length; c++)
{
if (curItem == c)
{
Console.Write(">");
Console.WriteLine(menuItems[c,0]);
Console.ForegroundColor = ConsoleColor.Green;
}
else
{
Console.WriteLine(menuItems[c,0]);
}
}
Console.WriteLine("Please select an option with the Arrow Keys");
}
}
public static void entries()
{
switch (menuItems[0,0])
{
case "Add Entry":
break;
case "Delete Entry":
break;
case "Print Book to Screen":
break;
case "Edit Contact":
break;
case "Exit":
break;
}
}