为什么我的c#程序不会运行?

L33*_*ePK -5 c#

我是一名刚开始学习c#的单身学生.我确信有一个简单的解决方案,但我已经搜索过,我认为还不够.这是我的程序,注意我还没有完成一些功能.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            public void welcome()
            {
            Console.WriteLine("Fuel Consumption Calculator "+"r/n"+"Are you using Metric 1 or Imperial 2 ?");
            }


            public void check()
            {
                string choice;
                choice = Console.ReadLine();
                if (choice == "1")
                {
                    calcmetric();
                }
                else
                {
                    calcimperial();
                }

            }
             public void calcmetric()
             {
             }
            public void calcimperial()
             {
             }
        }

    }
}
Run Code Online (Sandbox Code Playgroud)

在Visual Studio中,我有两个错误:一个在预期后会出现'}' Main; 并且在最后说"类型或命名空间定义错误"时出错.

NAS*_*SER 5

您正在声明方法内部的方法.这是错的.

更改:

class Program
{
    static void Main(string[] args)
    {
        //call other methods here
        welcome();
        check();
        //....            
    }
    public static void welcome()
    {
        Console.WriteLine("Fuel Consumption Calculator "+"r/n"+"Are you using Metric 1 or Imperial 2 ?");
    }


    public static void check()
    {
        string choice;
        choice = Console.ReadLine();
        if (choice == "1")
        {
            calcmetric();
        }
        else
        {
           calcimperial();
        }

    }
    public static void calcmetric()
    {
    }
    public static void calcimperial()
    {
    }
}
Run Code Online (Sandbox Code Playgroud)