Visual Studio C# Question About Casting and Type Conversion
I finished learning pythin recently and wanted to move on to something else so I chose C#. I found a course on Udemy and I have some questions.
Earlier, we learn about casting and explicit type conversion. The video shows an example of converting a int variable initalized to 1000. It would use casting to convert it to a byte (which has a max range of 255). image of screen. He runs the code and it returns a 232 which shows that data loss is going on. I understand all this.
My question is: in example 2, why did it crash? Why didn't it just attempt to convert it with data loss like the first example? Or Why didn't example 1 crash since the number 1000 is larger than the 255 range max?
Submitted July 17, 2017 at 06:06PM by BigB69
via reddit http://ift.tt/2utdv2B