Posts Tagged ‘Syste’

Compute numeric values in arrays with System.Linq namespace

Written by Ingmar Verheij on June 15th, 2011. Posted in VB.Net

Mathematics

Microsoft .NET Framework can store values in an array which makes it easy to use in methods and properties. An array can contain any kind of object, but I most commonly use it to store numeric value.

A greate property of numeric values is that you can compute them to a different value, and use that value to derive conclusions of any kind (I might sound like a madman , but figures somehow interest me).

A simple example of computing numeric values is deriving the lowest number is a range of number or the average of all numbers. .NET has a method that can compute this easily for you, but it’s a bit hidden)

Let’s take the following range of numbers: 0,1, 2, 3, 4. The lowest number in this range is 0 and the average is 2 (0+1+2+3+4 / 5). That’s easy.

Donate