Hello,
Recently i started making a item container, and every time the user tries to add an item into the container. If somehow the same item type exists, it'll stack them on top of each other, but there's a limit, which is int.MaxValue
and if i tried:
if (2147483647 + 2147483647 > int.MaxValue)
That would give me the following error:
The operation overflows at compile time in checked mode
So i tried to use the unchecked keyword like so:
unchecked
{
if (2147483647 + 2147483647 > int.MaxValue)
{
}
}
but this doesn't show trigger the if statement at all (I'm guessing it's wrapped around a Logical AND operator?)
Is there other ways to do this? (without using something like a int64, etc)