C# 错误CS0201-can';我不明白是什么';我的密码有问题吗

C# 错误CS0201-can';我不明白是什么';我的密码有问题吗,c#,compiler-errors,C#,Compiler Errors,我希望用户输入自己的名字,并得到控制台的欢迎。不知道我做错了什么 编辑:ok看起来像控制台。读取是问题所在。不知道为什么 using System; namespace Program1 { // use can use regions to wrap code in them and they can be collapsed #region class Program { static void Main(string[] args)

我希望用户输入自己的名字,并得到控制台的欢迎。不知道我做错了什么

编辑:ok看起来像控制台。读取是问题所在。不知道为什么

using System;

namespace Program1
{
    // use can use regions to wrap code in them and they can be collapsed
    #region 
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter ur name : "); // showing a msg to user
            string name = Console.ReadLine(); // defining a string variable and getting input from user
            Console.WriteLine("Hello " + name); // saying hi to user by adding his name that we asked earlier
            Console.WriteLine("Press any key to terminate ...");
            Console.Read;
        }
        #endregion // use can use regions to wrap code in them and they can be collapsed
    }
}

Console.Read后面缺少一个括号,应如下所示
Console.Read()

谢谢!你能帮我更好地理解这类错误吗?这种错误通常发生在什么情况下?这是一个编译器错误,如果没有正确的语法,您无法编译代码。Console.ReadLine()是一个方法,这是在C#中调用方法的方式,您总是在方法名称后使用括号。当您尝试编译时,VisualStudio应该在错误列表窗口下的代码下面加上红色下划线,从而给您一条错误消息。简单的“Console.Read”将调用未在控制台上定义的属性“Read”的getter。但是错误是,无论如何,如果不使用返回值,就不能调用getter。而且#endregion应该在类定义结束之后,以获得更好的结构,否则折叠它时看起来会很奇怪。