C# 7.3 (.NET Framework 4.7.2)
using System;
public class Program
{
public static void Main()
int[,] x = { {81, 105, 5}, {17, 18, 93}, {7, 6, 178} };
Console.Write(Min(x));
}
public static T Min<T>(T[,] source)
where T: IComparable
var rows = source.GetLength(0);
var cols = source.GetLength(1);
var min = source[0,0];
for (int i = 0; i < rows; i++)
for (int k = 0; k < cols; k++)
if (source[i,k].CompareTo(min) < 0)
min = source[i,k];
return min;
C# 7.3 (.NET Framework 4.7.2)
using System;
public class Program
{
public static void Main()
{
int[,] x = { {81, 105, 5}, {17, 18, 93}, {7, 6, 178} };
Console.Write(Min(x));
}
public static T Min<T>(T[,] source)
where T: IComparable
{
var rows = source.GetLength(0);
var cols = source.GetLength(1);
var min = source[0,0];
for (int i = 0; i < rows; i++)
for (int k = 0; k < cols; k++)
{
if (source[i,k].CompareTo(min) < 0)
min = source[i,k];
}
return min;
}
}