Assuming .NET Framework 3.5 or greater:
var l = new List<int>() { 1, 3, 2 };
var max = l.Max();
Console.WriteLine(max); // prints 3
Lots and lots of cool time-savers like these in the Enumerable class.
More Related Contents:
- KeyValuePair with generic values [closed]
- i Want the following conversion for the table
- OpenFileDialog is not opening the file [closed]
- Unable to create a constant value of type Only primitive types or enumeration types are supported in this context
- How can I deserialize a child object with dynamic (numeric) key names?
- Deserializing JSON with unknown object names
- Best way to determine if two path reference to same file in C#
- Loading DLLs into a separate AppDomain
- Classes residing in App_Code is not accessible
- how to run visual studio without plugin and all third party feature
- Error: “The specified LINQ expression contains references to queries that are associated with different contexts”
- No templates in Visual Studio 2017
- How do I convert an ISO8601 TimeSpan to a C# TimeSpan?
- C# regex to remove non – printable characters, and control characters, in a text that has a mix of many different languages, unicode letters
- How to render a WPF UserControl to a bitmap without creating a window
- linq to entities doesn’t recognize a method
- How can I format a nullable DateTime with ToString()?
- Creating a proxy to another web api with Asp.net core
- How to get video duration from mp4, wmv, flv, mov videos
- How to implement Permission Based Access Control with Asp.Net Core
- Dependency injection in unit of work pattern using repositories
- C#: Prepending to beginning of a file
- A way of casting a base type to a derived type
- WPF OpenFileDialog with the MVVM pattern? [duplicate]
- What’s the difference between UTF8/UTF16 and Base64 in terms of encoding
- Error handling (Sending ex.Message to the client)
- Start stop Service from Form App c#
- iTextSharp Password Protected PDF
- Xamarin iOS memory leaks everywhere
- How do I use Selenium in C#?