[c#] Better way to cast object to int