top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to Get the Max Value from a List of Integer using LINQ Query in C#?

+1 vote
550 views
How to Get the Max Value from a List of Integer using LINQ Query in C#?
posted Apr 30, 2016 by Sathyasree

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
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();

}

}

}
answer Apr 30, 2016 by Shivaranjini
...