并调用类的共有方法

    1. // See https://aka.ms/new-console-template for more information
    2. using System;
    3. namespace HelloWorld
    4. {
    5. class Program
    6. {
    7. public int Findmax(int a,int b)
    8. {
    9. return a > b ? a : b;
    10. }
    11. }
    12. class Test
    13. {
    14. static void Main()
    15. {
    16. string characterName = "yulin";
    17. int age = 20;
    18. Console.WriteLine("There was a person named " + characterName);
    19. Console.WriteLine("Hello, World!");
    20. Console.WriteLine("age is " + age);
    21. // int num = Convert.ToInt16(Console.ReadLine());
    22. // Console.WriteLine("num is " + num);
    23. Program h = new Program();
    24. int res = h.Findmax(2, 5);
    25. Console.WriteLine("res is " + res);
    26. }
    27. }
    28. }