C#: Unable to cast object of type ‘System.Int64’ to type ‘System.Int32’

I have code as follows: Dictionary<object, object> dict = … Color = (int)dict.GetValue(“color”); When I convert the Color to an int, I get the following exception: System.InvalidCastException: Unable to cast object of type ‘System.Int64’ to type ‘System.Int32’. I am not sure why I can’t just cast from a long to an int. I know for […]

By Kostub Deshmukh
Published
Categorised as Uncategorised Tagged , , ,

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq