Operator '*' cannot be applied to operands of type 'double' and 'decimal'
If you ever encounter this error when compiling your C# program, don't be alarmed! Obviously, arithmetic operations ARE supported for decimal, double, etc... You're just not allowed to mix double/float and decimal in arithmetic operations.
For instance, the following code will generate the above error:
For instance, the following code will generate the above error:
decimal val = 0.45M;
decimal result = 0.15 * val;
Just change the second line as shown below to get rid of the error:
decimal result = 0.15 * val;
decimal result = 0.15M * val;
