Проблема то ли с позиционированием метода, то ли что-то ещё

using System;

public class Program
{

    public static void Main()
    {
        int n = 3;
        int m = 10;
        int n1 = 0;
        int m1 = 0;
        string[,] buddyBook = new string[n, m];
        int [,] sort_directive = new int[n1, m1];


        Console.WriteLine("Welcome to BuddyBook!\nInput E to enter Menu\nInput X to exit");
        string ans = Console.ReadLine();
        string [] ema = new string [100];
        string [] num = new string [100];
        string [] org = new string [100];
        if ((ans == "E") || (ans == "e"))
        {
            while((ans != "X") || (ans != "x"))
            {
                Console.Clear();
                Console.WriteLine("1. Print BuddyBook:\n\t(A) Ascending order\n\t(B) Descending order\n2. Add Buddy\n3. Delete Buddy\n4. Update Buddy\n5. Search Buddy\n\t(A) Name\n\t(B) Phone number\n6. Exit");
                ans = Console.ReadLine();
                if ((ans == "X") || (ans == "x")){Console.WriteLine("See you soon!"); break;}
                switch (ans)
                {
                    case "1":
                        bookAdd();
                        break;

                    case "8":
                        return;
                    default:
                        Console.WriteLine("No such option here, try again\n");
                        break;
                }
            }
        }
        void bookAdd(){
            Console.Clear();
            Console.Write("Enter name: "); 
        }
    }
}

Это псевдо-обрезок кода всего проекта


После предложения поставить static перед bookAdd:

Вот сама ошибка:

Feature 'static local functions' is not available in C# 7.3. Please use language version 8.0 or greater.


Ответы (1 шт):

Автор решения: Igor
public class Program
{

  public static void Main()
  {
    ...
  }

  static void bookAdd()
  {
    Console.Clear();
    Console.Write("Enter name: "); 
  }
}
→ Ссылка