我最近用 C# 编写了这个简短的应用程序:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Checker
{
    class Program
    {
        static void Main(string[] args)
        {
            Properties.Settings.Default.Save();
            Program re = new Program();
            re.next();
        }
        public void next()
        {
            Console.WriteLine("Have you already entered name?");
            int ch = int.Parse(Console.ReadLine());
            if (ch == 0)
            {
               Console.WriteLine("What is your name?");
               String name = Console.ReadLine();
               Console.WriteLine("Thank you!");
               Console.ReadKey();
            }
            Console.WriteLine("Your name is " + name);
        }
    }
}
现在,我创建了一个设置文件,并在那里创建了一个“名称”变量,类型为“字符串”。
它的范围是“用户”。
所以我希望它使用属性行加载“名称”变量,但由于此错误,我什至无法编译程序:
Error   1   The name 'name' does not exist in the current context
我该如何解决?