Tuesday, August 9, 2016

Params

  • Function accept varying number of arguments
  • Takes a variable number of arguments or even no argument.
  • if is object, it can accept any data type, can same or different 
  • Only in 1 Param.
    var countCoffee = CupOfCoffee.SumCoffee(mixedCoffee, cupOfCoffee, 234);

    public static int SumCoffee(params object[] list)
    {
         return list.Count();
    }

    No comments:

    Post a Comment