How to write a method that receives int array parameter in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arr = { 3, 23, 55, 100, 3531 };

            PrintArray(arr);
        }
        static void PrintArray(int[] arr)
        {
            foreach (int n in arr)
                Console.WriteLine(n);
        }
    }
}


/*
run:
      
3
23
55
100
3531

*/

 



answered Dec 28, 2016 by avibootz
...