Table of Contents

Class Percentage

Namespace
ElectricDrill.SoapRpgFramework.Utils
Assembly
com.electricdrill.soap-rpg-framework.Runtime.dll

The Percentage class represents a percentage value and provides various operators and conversions.
Implicit long to Percentage value conversion is available. To express a 100% value, use 100L.
Implicit Percentage to double conversion is available. When doing so, the percentage is automatically divided by 100.

[Serializable]
public class Percentage
Inheritance
object
Percentage

Constructors

Percentage(long)

Initializes a new instance of the Percentage class with the specified value. To express a 100% value, use 100L.

public Percentage(long value)

Parameters

value long

The value of the percentage.

Methods

CompareTo(Percentage)

Compares the current Percentage instance with another Percentage instance.

public int CompareTo(Percentage other)

Parameters

other Percentage

The other percentage to compare to.

Returns

int

An integer indicating the relative order of the percentages.

ToString()

Returns a string representation of the percentage value.

public override string ToString()

Returns

string

A string representing the percentage value.

Operators

operator +(Percentage, Percentage)

Overrides the + operator to add two Percentage instances.

public static Percentage operator +(Percentage a, Percentage b)

Parameters

a Percentage

The first percentage.

b Percentage

The second percentage.

Returns

Percentage

A new Percentage instance representing the sum.

explicit operator long(Percentage)

Explicit conversion from Percentage to long. The conversion does not divide the value by 100.

public static explicit operator long(Percentage percentage)

Parameters

percentage Percentage

The percentage to convert.

Returns

long

implicit operator double(Percentage)

Implicit conversion from Percentage to double. The conversion automatically divides the value by 100.

public static implicit operator double(Percentage percentage)

Parameters

percentage Percentage

The percentage to convert.

Returns

double

implicit operator Percentage(long)

Implicit conversion from long to Percentage. To express a 100% value, use 100L.

public static implicit operator Percentage(long value)

Parameters

value long

The value to convert.

Returns

Percentage

operator -(Percentage, Percentage)

Overrides the - operator to subtract one Percentage from another.

public static Percentage operator -(Percentage a, Percentage b)

Parameters

a Percentage

The first percentage.

b Percentage

The second percentage.

Returns

Percentage

A new Percentage instance representing the difference.

operator -(Percentage)

Overrides the unary - operator to negate a Percentage.

public static Percentage operator -(Percentage a)

Parameters

a Percentage

The percentage to negate.

Returns

Percentage

A new Percentage instance representing the negated value.