C# Compiler Error
CS0110 – The evaluation of the constant value for ‘const declaration’ involves a circular definition
Reason for the Error
You will receive this error when you declare a constant which references another constant that also references the previously declared constant (Eg : cyclic or circular definition).
For example, lets look at the below code snippet.
public class DeveloperPublish { public const int constant1 = constant2; public const int constant2 = constant1; public static void Main() { } }
The class contains two constant variables declared and one references the other. This results in the CS0110 error.
Error CS0110 The evaluation of the constant value for ‘DeveloperPublish.constant1’ involves a circular definition ConsoleApp1 C:\Users\Senthil\source\repos\ConsoleApp1\ConsoleApp1\Program.cs 3 Active
Solution
To fix the above error, remove the circular definition and provide right values for the constant variables.