System Max is a package library in C# that contains classes and methods for finding the maximum value of a given collection.
Example 1: Finding the maximum value in an array
int[] numbers = { 4, 8, 2, 9, 5 }; int max = System.Linq.Enumerable.Max(numbers); Console.WriteLine("The maximum value in the array is " + max);
In this example, the Enumerable Max method from the System.Linq namespace is used to find the maximum value in an array of integers.
Example 2: Finding the maximum value in a list
List values = new List { 3.4, 8.7, 2.1, 9.5, 5.6 }; double max = System.Collections.Generic.List.Max(values); Console.WriteLine("The maximum value in the list is " + max);
In this example, the List Max method from the System.Collections.Generic namespace is used to find the maximum value in a list of doubles.
Overall, the System Max package library provides useful methods for finding maximum values in various collections in C#.
C# (CSharp) System.Max - 30 examples found. These are the top rated real world C# (CSharp) examples of System.Max extracted from open source projects. You can rate examples to help us improve the quality of examples.