The multiplication operator (*) computes the product of its operands. All numeric types have predefined multiplication operators.
The * operator is also used to declare pointer types and to dereference pointers.
User-defined types can overload the * operator (see operator).
using System; class Test { public static void Main() { Console.WriteLine(5 * 2); Console.WriteLine(-.5 * .2); Console.WriteLine(-.5m * .2m); // decimal type } }
10 -0.10000000000000001 -0.1
Note that the double type cannot represent the value -0.1 exactly, while the decimal type can.
C# Operators | CLR 7.7.1 Multiplication operator