Convert.ChangeType matrix

138 Views Asked by At

Is there any resource that shows .NET Convert.ChangeType() results in a table? i.e. converting from which type to which type will be successful, overflow, invalid cast or throwing other exceptions.

In particular, I want to know whether converting between signed and unsigned numerals of the same size (e.g. Int32 and UInt32) will be successful, overflow or invalid cast.

1

There are 1 best solutions below

1
On

int32 max value is 2,147,483,647 and UInt32 max value is 4,294,967,295 so if you converted a number to uint32 from int32 and stuck to int32 max boundary and vise versa there will be no issue, otherwise it will give you an exception division by zero i guess