[Solved] C# – var not behaving as expected in for loop


var X = 0

This is the line that declares X’s type, regardless of how it’s later used. When you specify a numerical literal without any suffixes, it will be an integer. Here’s one possible solution.

var X = 0L

solved C# – var not behaving as expected in for loop