- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# Queryable Min Method
Get the minimum value from a sequence using the Min() method in C#.
The following is our list.
List<long> list = new List<long> { 1, 2, 3, 4, 5, 6 };
Now, use Queryable Min() method to get minimum element.
list.AsQueryable().Min();
Example
using System; using System.Collections.Generic; using System.Linq; class Demo { static void Main() { List<long> list = new List<long> { 1, 2, 3, 4, 5, 6 }; foreach(long ele in list) { Console.WriteLine(ele); } // getting lowest element long min_num = list.AsQueryable().Min(); Console.WriteLine("Smallest number = {0}", mix_num); } }
Advertisements