The name '…' does not exist in the current context
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a list within my Main() and I'm trying to add an item to that list from within a variable. But it's throwing the error "The name 'dogList' does not exist in the current context" Inside my addDog() method, dogList.Add() is not working due to above. namespace DoggyDatabase { public class Program { public static void Main(string[] args) { // create the list using the Dog class List dogList = new List (); // Get user input Console.WriteLine("Dogs Name:"); string inputName = Console.ReadLine(); Console.WriteLine("Dogs Age:"); int inputAge