The multiplication operator (*) computes the product of its operands. All numeric types have predefined multiplication operators.
expr1 * expr2
Where:
The * operator is also used to declare pointer types and to dereference pointers (see
User-defined types can overload the * operator (see operator).
// cs_operator_mult.cs
using System;
class Test
{
public static void Main()
{
Console.WriteLine(5 * 2);
Console.WriteLine(-.5 * .2);
Console.WriteLine(-.5m * .2m); // decimal type
}
}
10 -0.1 -0.10
C# Operators |