I think it's clever, but I can't say that I'm thrilled that this is possible. If I were using a library and got a "possible null reference exception" from a value type, I'd likely waste a fair amount of time trying to figure out what was going wrong.
I'm generally not a fan of blurring the lines between values and references.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
I'm not advocating this as the "best way:" I can see a valid argument foe using an out parameter, and returning a bool ... building on the 'TryParse syntax we are used to. I think I'll add the code for that technique to the post, and perhaps, get some more reactions.
By the way: in practice, I'm fanatic about controlling numeric entry in TextBoxes by using Key Event handlers to screen out unacceptable key entries, so this experiment is just a challenge I took on to get familiar with the 'TypeConverter facility.
The use of the currently shown code looks like this:
var v0 = tBxNumericUC1.Text.TryParse1<int>();
if (v0 != null)
// use v0
The usage of the code that's more like 'TryParse would look like:
if (tBxNumericUC1.Text.TryParse<int>(outint iresult)
// use iresult
«... thank the gods that they have made you superior to those events which they have not placed within your own control, rendered you accountable for that only which is within you own control For what, then, have they made you responsible? For that which is alone in your own power—a right use of things as they appear.» Discourses of Epictetus Book I:12
I resent the use of the term spamming and the confrontational tone of your posting.
For your information I had an account with another name (company email, no longer accessible), posted in the WPF forum, got no answer after many days, posted a link in this forum, and got an answer almost immediately. Hence why I am/was not sure which was the best forum for the question.
I have C# COM dll used in one of the module (lets call as A) and it already into the market.
For my other new module , i need same functionality as C# COM dll, So i used the same code and generated dll(the Common C# DLL is same for two modules and need to located in same place after installation)
Since C# COM dll name and location is same for both modules, i cant work on both the modules at a time
either i need to play with register /unregister and work with one module.
How can i make this C# COM dll with same name and same location to work for two projects/modules?
Help is greatly appreciated.