Float Extensions

Universal CS Scripts - Scripts - Float Extensions

How to work out a percentage with C#

The maths for working out a percentage is quite simple just divide the current number by the maximum and multiply by 100.

public static float Percentage(this float current ,float maximum) => (current / maximum) * 100;

FloatExtensions.cs 207B


using System;
using System.Collections.Generic;
using System.IO;

static class FloatExtensions
{
   public static float Percentage(this float current ,float maximum) => (current / maximum) * 100;
}
Powered by w3.css