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.
Example
The following code generates error CS0463.
// 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.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for