c# int array max size code example
Example 1: c# array max
----------------------------------------------------
HIGHEST
----------------------------------------------------
var highest 0;
var index;
var x = 0;
int[] arry = new int[]{1,2,3,4,5,6,7,8};
foreach (dynamic i in arry)
{
if (i > highest){ highest = i; index = x; }
x++;
}
----------------------------------------------------
OR
----------------------------------------------------
using System.Linq;
int maxValue = anArray.Max();
----------------------------------------------------
----------------------------------------------------
LOWEST
----------------------------------------------------
var highest = 100000000000;
var index;
var x = 0;
int[] arry = new int[]{1,2,3,4,5,6,7,8};
foreach (dynamic i in arry)
{
if (i < highest){ highest = i; index = x; }
x++;
}
----------------------------------------------------
Example 2: max int python
import sys
MAX_INT = sys.maxsize - 1
Example 3: see max value in array c#
using System.Linq;
int maxValue = anArray.Max();