Hemalatha Sunnapu

Hemalatha Sunnapu

  • NA
  • 169
  • 20.3k

Params prameter, is giving error while accesing.

Jul 25 2018 11:50 PM
namespace ParamsCheck
{
   class Program
   {
      public void Method(params int [] arr)
      {
      arr[1]=Convert.ToInt32( Console.ReadLine());
      }
      static void Main(string[] args)
      {
      Program obj = new Program();
      //int[] arr = new int[1];
      int []arr= {1 };
      obj.Method();
      Console.Read();
      }
   }
}
 
 
 I am getting this error.
 
 

Answers (5)