ChensHelpers
Chen.Helpers.MathHelpers.Arithmetic
Arithmetic.SafeDivide(int, int, int) Method
Performs division with a safety check when the divisor is 0.
The parameter fallbackResult will be returned instead if the divisor is 0.
public static int SafeDivide(this int dividend, int divisor, int fallbackResult=0);
Parameters
dividend
System.Int32
The number being divided
divisor
System.Int32
The number that will divide the dividend
fallbackResult
System.Int32
Return value if the divisor is 0
Returns
System.Int32
The quotient or the fallbackResult