Array Methods in C-Sharp

Array Methods in C-Sharp

Useful Methods to Return values in Arrays
Here are the available methods to get values in an array.

  • Max returns the largest value.
  • Min returns the smallest value.
  • Sum returns the sum of all elements.
Examples :
Let’s consider this array :
int[ ] arr = { 2, 4, 7, 1};
Console.WriteLine(arr.Max());
//Outputs :  7
Console.WriteLine(arr.Min());
//Outputs : 1Console.WriteLine(arr.Sum());
//Outputs : 14

Social Share

Leave a Reply

Your email address will not be published. Required fields are marked *