Skip to main content Link Search Menu Expand Document (external link)

* : Multiplication Operator


On this page

Summary

Multiply two numeric values together.

Syntax



Precedence

Priority level in expression evaluation (1 = highest, 10 = lowest): 4

Evaluated after: ^

Evaluated before: +, -, <, <=, >, >=, ==, !=, ??, &&, ||


Operands

Position Type Description
Left Number First multiplicand
Right Number Second multiplicand

Returns

Type: Number (Int, Long, Double, or Decimal depending on operands)

The product of the left and right operands.


Examples

Line Item Total

<p>Total: $</p>

Data:

doc.Params["model"] = new {
    quantity = 5,
    price = 19.99m
};

Output:

<p>Total: $99.95</p>

Area Calculation

<p>Area:  sq ft</p>

Data:

doc.Params["model"] = new {
    width = 12.5,
    height = 8.0
};

Output:

<p>Area: 100 sq ft</p>

Tax Calculation

<p>Subtotal: $</p>
<p>Tax (%): $</p>
<p>Total: $</p>

Data:

doc.Params["model"] = new {
    price = 100.00m,
    taxRate = 0.08m
};

Output:

<p>Subtotal: $100.00</p>
<p>Tax (8%): $8.00</p>
<p>Total: $108.00</p>

Percentage Calculation

<p>% correct</p>

Scaling Values

<!-- SVG bar chart with scaled heights -->

  <rect height="" />

Data:

doc.Params["model"] = new {
    data = new[] {
        new { value = 50 },
        new { value = 75 },
        new { value = 100 }
    },
    scaleFactor = 2
};

Notes

  • Works with all numeric types (int, long, double, decimal)
  • Result type depends on operand types (follows C# numeric promotion rules)
  • Use parentheses to control order of operations
  • Multiplication has higher precedence than addition/subtraction
  • For exponentiation, use the ^ operator or pow() function
  • Cannot multiply non-numeric types

See Also