变量的作用域
namespace ConsoleApplication3
{
class Program
{
static void write()
{
string mystring = "string defined in wrtie()";
Console.WriteLine("now in write()");
Console.WriteLine("mystring={0}", mystring);
}
static void Main(string[] args)
{
string mystring = "string defined in Main()";
write();
Console.WriteLine("\nnow in Main()");
Console.WriteLine("mystring={0}", mystring);
Console.ReadKey();
}
}
}