Click here to Skip to main content
15,888,212 members

Comments by C Pottinger (Top 19 by date)

C Pottinger 13-Feb-24 6:55am View    
Thank you, Graeme. Your analysis matches exactly what I was seeing happen.
Since the conversion cannot be customized, I will have to rethink the idea of applying all the interfaces commonly used by the intrinsic numeric types.
I will look into the TypeConverter class, as you suggested.
And thank you for the link to the .NET source browser - I was not aware of this resource.
C Pottinger 9-Feb-24 21:06pm View    
I have created a stripped down program. Stepping through it shows that the call to TryConvertFromChecked() does not call the one defined in the code.

https://drive.google.com/file/d/1J028ZWLARdQo9xlk_RLIs8-WSyQkFMoI/view?usp=sharing
C Pottinger 9-Feb-24 21:05pm View    
It seems that .NET does do generic type conversions - at least that is what Systems.Numerics.INumberBase seems to suggest (see https://learn.microsoft.com/en-us/dotnet/api/system.numerics.inumberbase-1.tryconvertfromchecked?view=net-8.0#system-numerics-inumberbase-1-tryconvertfromchecked-1(-0-0@)).
The unit of measurement is not actually pertinent to the problem. I am just trying to find out the proper way to set up and/or call my implementation of TryConvertFromChecked.
C Pottinger 24-Apr-23 13:00pm View    
Thank you, Richard.

Sometimes I can't see the forest for the trees. I didn't even occur to me that the error was not a log4net error, but an actual error in the config. I also didn't know that the <system.web> and <runtime> sections were no longer needed. I guess they just came along for the ride when I upgraded to .NET 6.
C Pottinger 17-Feb-22 15:26pm View    
I don't see how that would stop a user of the class from using the wrong constructor.