One of the easiest way to get the Max value from a List of Integer in C# is to use LINQ extension method. The LINQ in C# provide the Max method which can be used to retrieve the Max Value from the List.
How to Get the Max Value from a List of Integer using LINQ Query in C#?
using System; using System.Collections.Generic; using System.Data; using System.Linq; namespace AbundantCode { internal class Program { // How to Get the Max Value from a List of Integer using LINQ Query in C#? private static void Main(string[] args) { int[] Marks = new int[] { 1, 2, 8, 3, 10, 25, 4 }; // Get Max using LINQ Query var result = (from m in Marks select m).Max(); Console.WriteLine(result); Console.ReadLine(); } } }
How to get the max value of a column which has type as char using LINQ ?
Eg. for Column Value ITM108, ITM99, ITM102, Etc…
How do you want to get the maximum value of a column in this case ?
Based on the length of the string ? or based on the value for example : ITM 108 and you want to consider only the numeric field by splitting the string ?
Check the article and code snippet at http://abundantcode.com/how-to-get-the-maximum-value-from-a-list-of-string-using-linq-in-c/