Given this code:
List things = new List(); foreach (string thing in things) { string foo = thing.ToUpper(); } string foo =
1条回答 猫巷女王i (楼主) 2021-01-20 10:33 While you can only refer to the outer foo after you declared it, locals are allocated at the beginning of a function which means the inner foo will overshadow the outer one, even if it hasn't been declared yet. 0 讨论(0) 发布评论: 提交评论 加载中... 自定义标题段落格式字体字号代码语言点击上传x 验证码 看不清? 提交回复
While you can only refer to the outer foo after you declared it, locals are allocated at the beginning of a function which means the inner foo will overshadow the outer one, even if it hasn't been declared yet.
foo
热议问题