Modulo Class

MSBuild

Performs the modulo operation on numbers.


Namespace: MSBuild.Community.Tasks.Math
Assembly: MSBuild.Community.Tasks (in MSBuild.Community.Tasks.dll)

Syntax

Visual Basic (Declaration)
Public Class Modulo
    Inherits MathBase
C#
public class Modulo : MathBase
C++
ref class Modulo : MathBase
J#
public class Modulo extends MathBase
JScript
public class Modulo extends MathBase

Example

Numbers evenly divide:

 Copy Code
<Math.Modulo Numbers="12;4">
    <Output TaskParameter="Result" PropertyName="Result" />
</Math.Modulo>
<Message Text="12 modulo 4 = $(Result)"/>
Above example will display:
 Copy Code
12 modulo 4 = 0
Division on the numbers produces a remainder:
 Copy Code
<Math.Modulo Numbers="14;4">
    <Output TaskParameter="Result" PropertyName="Result" />
</Math.Modulo>
<Message Text="14 modulo 4 = $(Result)"/>
Above example will display:
 Copy Code
14 modulo 4 = 2
Modulus is a fractional value:
 Copy Code
<Math.Modulo Numbers="12;3.5">
    <Output TaskParameter="Result" PropertyName="Result" />
</Math.Modulo>
<Message Text="12 modulo 3.5 = $(Result)"/>
Above example will display:
 Copy Code
12 modulo 3.5 = 1.5

Remarks

The modulo operation finds the remainder of the division of one number by another.

When the second number (modulus) is a fractional value, the result can be a fractional value.

Equivalent to the % operator in C# or the Mod operator in Visual Basic.

Inheritance Hierarchy

System.Object
   Microsoft.Build.Utilities.Task
      MSBuild.Community.Tasks.Math.MathBase
         MSBuild.Community.Tasks.Math.Modulo

Thread Safety

Public static (Shared in Visual Basic)staticShared members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

See Also

Syntax based on .NET Framework version 2.0.
Documentation version 1.0.0.0.