Skip to content
This repository was archived by the owner on Nov 13, 2018. It is now read-only.

Numeric methods

Jordan Kniest edited this page Jun 17, 2017 · 3 revisions

These methods are only available for numeric collections:

  • int
  • double
  • float
  • long

Avg

Return the average value

Structure:

public TYPE Avg();

Example:

// Create a new collection with three integers
var collection = new Collection<int>(10, 20, 30);

// Calculate the average value
var result = collection.Avg();

// Print the result to the console
Console.Write(result); // The result is: 30

Median

Return the median value

Structure:

// Create a new collection with three integers
var collection = new Collection<int>(10, 20, 30);

// Calculate the median value
var result = collection.Median();

// Print the result to the console
Console.Write(result); // The result is: 20

Clone this wiki locally