dotnet / try

Try .NET provides developers and content authors with tools to create interactive experiences.
MIT License
2.89k stars 522 forks source link

C# 教程的代码有问题 #179

Open aoxuely opened 5 years ago

aoxuely commented 5 years ago

Describe the bug Please provide as much information as you can. 网址:https://docs.microsoft.com/zh-cn/dotnet/csharp/tutorials/intro-to-csharp/list-collection?tutorial-step=2 这部分的代码如下: Console.WriteLine(); names.Add("Maria"); names.Add("Bill"); names.Remove("Ana"); foreach (var name in names) { Console.WriteLine($"Hello {name.ToUpper()}!"); } 并未有names的定义

Where did this error occur?

What kind of error was it?

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

ltm0203 commented 5 years ago

fix it

List<string> names=new List<string>();

Console.WriteLine();
names.Add("Maria");
names.Add("Bill");
names.Remove("Ana");
foreach (var name in names)
{
  Console.WriteLine($"Hello {name.ToUpper()}!");
}