Compiler Error CS0463
Evaluation of the decimal constant expression failed with error: 'error'
This error occurs when a constant decimal expression overflows at compile time.
Typically you get overflow errors at run time. In this case, you defined the constant expression in such a way that the compiler could evaluate the result and know that an overflow would happen.
The following code generates error CS0463.
C#
// CS0463.cs
using System;
class MyClass
{
public static void Main()
{
const decimal myDec = 79000000000000000000000000000.0m + 79000000000000000000000000000.0m; // CS0463
Console.WriteLine(myDec.ToString());
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: