Hi Im currently a student trying to figure out how to search a 2D Array in C#. The program that Im trying to make is an Address Book. Basically I want to search the array for a keyword such as "First Name", I then want to be able to print the result of that search and be able to edit that part of the array. Im just wondering if anyone knows a particular syntax such as Array.Find("First Name"). Heres the code, and thanks for looking and helping me. :)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication9
{
class AddressBook
{
static void Main(string[] args)
{
string InputSelection;
char Selection_Char;
string[,] AddressBook = new string[10, 2]//this is the array
{
{"First Name", "Last Name"},//i want to be able to search this array for First Name
{"XXXXX", "XXXXX"},
{"XXXXX", "XXXXX"},
{"XXXXX", "XXXXX"},
{"XXXXX", "XXXXX"},
{"XXXXX", "XXXXX"},
{"XXXXX", "XXXXX"},
{"XXXXX", "XXXXX"},
{"XXXXX", "XXXXX"},
{"XXXXX", "XXXXX"}
};
Start:
Console.WriteLine("==========Address Book==========");
Console.WriteLine("Press 1 to Add an Entry.");
Console.WriteLine("Press 2 to Delete an Entry.");
Console.WriteLine("Press 3 to Print Book to Screen.");
InputSelection = Console.ReadLine();
Selection_Char = Convert.ToChar(InputSelection);// Converts the Users input to char