C# how to use delegetion in your code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


delegate void player();

namespace delegationkeyword
{

    class players
    {
       public  static int choice;
       public  static void list() {
            Console.WriteLine("HERE IS THE LIST OF FIVE PLAYERS");
       Console.WriteLine("1- VIRAT KOHLI   \n 2- STEVEN SMITH \n 3- JOE ROOT \n 4- YOUNUS KHAN  \n 5- kANE WILLIAMSOM");
       Console.WriteLine("now enter favourite player input ");
       choice = Convert.ToInt32(Console.ReadLine());
       if (choice == 1)
       {
       Console.WriteLine("MATCHES= 12  RUNS=1215       AVERAGE= 75.93             S-R=60.41");

      
       }
            if(choice==2){
           
              Console.WriteLine("MATCHES=11   RUNS=1079       AVERAGE=71.93              S-R=58.73");


           
            }
             if(choice==3){

                 Console.WriteLine("MATCHES=17   RUNS=1477          AVERAGE=49.23              S-R=60.70");


           
            }
             if (choice == 4)
             {
                 Console.WriteLine("MATCHES=10   RUNS=673           AVERAGE=37.38              S-R=50.48");


            
            
             }
             if (choice == ){
                 Console.WriteLine("MATCHES=10   RUNS=753           AVERAGE=47.06              S-R=53.4 }

        }  


        static void Main(string[] args)
        {
            player abc = new player(list);
            list();
            Console.ReadKey();
        }
    }

}
OUTPUT



No comments:

Post a Comment