Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Literal of type double cannot be implicitly converted to type 'type'; use an 'suffix' suffix to create a literal of this type
An assignment could not be completed; use a suffix to correct the instruction. The documentation for each type identifies the corresponding suffix for the type. For more information on conversions, see Casting and Type Conversions.
The following sample generates CS0664:
// CS0664.cs
class Example
{
static void Main()
{
decimal d1 = 1.0; // CS0664, because 1.0 is interpreted
// as a double.
// Try the following line instead.
decimal d2 = 1.0M; // The M tells the compiler that 1.0 is a
// decimal.
Console.WriteLine(d2);
}
}