C#变量的作用域
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo
{
class Program
{
static string text;
static void Main(string[] args)
{
int i;
//string text="";
for (i=0;i<10;i++)
{
text = "Line" + Convert.ToString(i);
Console.WriteLine("{0}",text);
}
Console.WriteLine("Last text output in loop:{0}",text);
Console.ReadKey();
}
}
}