C#语法错误,似乎没什么错

php*_*exe 0 c# syntax-error

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

namespace SchoolPasswordLockFolder
{
    public class Program
    {
        public static void Main(string[] args)
        {
           Console.WriteLine("Enter the password: "); // the space character after the semicolon has an error
            public string input = Console.ReadLine();

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

错误:

Severity    Code    Description Project File    Line
Error   CS1513  } expected  SchoolPasswordLockFolder    c:\Users\CENSOREDSIJGIOFSGJIOFS\documents\visual studio 2015\Projects\App5\SchoolPasswordLockFolder\SchoolPasswordLockFolder\Program.cs 14
Run Code Online (Sandbox Code Playgroud)

(对于分号后的那个)和

Severity    Code    Description Project File    Line
Error   CS1022  Type or namespace definition, or end-of-file expected   SchoolPasswordLockFolder    c:\Users\CENSOREDIDONTWANTSTALKERS\documents\visual studio 2015\Projects\App5\SchoolPasswordLockFolder\SchoolPasswordLockFolder\Program.cs  19
Run Code Online (Sandbox Code Playgroud)

(对于最后一个括号)我没有用C#编程很长一段时间,因为我太忙于web开发和lua ......

Dav*_*eau 5

改变这个:

public string input = Console.ReadLine();
Run Code Online (Sandbox Code Playgroud)

至:

string input = Console.ReadLine();
Run Code Online (Sandbox Code Playgroud)

局部变量不能获得类似的可访问性修饰符public.