Home » C# Array to Function

C# Array to Function

by Online Tutorials Library

C# Passing Array to Function

In C#, to reuse the array logic, we can create function. To pass array to function in C#, we need to provide only array name.

C# Passing Array to Function Example: print array elements

Let’s see an example of C# function which prints the array elements.

Output:

Printing array elements: 25 10 20 15 40 50 Printing array elements: 12 23 44 11 54 

C# Passing Array to Function Example: Print minimum number

Let’s see an example of C# array which prints minimum number in an array using function.

Output:

Minimum element is: 10 Minimum element is: 11 

C# Passing Array to Function Example: Print maximum number

Let’s see an example of C# array which prints maximum number in an array using function.

Output:

Maximum element is: 50 Maximum element is: 64 

You may also like