Exception in C#

I am pretty much new to the C# world. I was just trying some basic codes the other day, so I decided to write one that emulates a basic calculator. I have used interface in it, and as there was the probability of both integer and the float types of values, I decided to use double type integer.

It was a successful coding, and I was pretty happy with it, but then I thought that as there was the option of division in the program, why not use some exception handling in there, as to prevent a runtime error, if a number was being divided by zero.

But. To my surprise, the code threw no exception, and when a divided-by-zero operation was performed, the value came out to be ‘infinity'! I didn't knew the double type had a provision for this.

Check the code out.

Ebook Download
View all
Learn
View all