using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MethodExample { class Program { public int MyMethod() { Console.WriteLine("this is MyMethod"); int i = 100; return i; } static void Main() { Program method = new Program(); int j = 50; j = method.MyMethod(); //调用MyMethod()方法 Console.WriteLine("the value is {0}",j); Console.ReadLine(); } } }