10-02-2008 06:50 AM
Hello,
Let's assume I have a .NET function.
It accepts a string as parameter.
I would like to be able to pass a null reference to the function ( not an empty string, but a null ref ).
Can this be done?
I prepped a word doc with specific example described.
10-02-2008 09:28 AM - edited 10-02-2008 09:28 AM
As far as I know you cannot directly connect a null reference to a string input. Whatever you do in between will change the datatype, and use a default value for the string, which would be an empty string.
A better code implementation for your .NET code would be to use the String.IsNullOrEmpty() static method, rather than the C-style "==" way.
10-02-2008 11:15 AM - edited 10-02-2008 11:18 AM
Hello,
Thanks for your suggestion.
It is exactly the way the C# code is implemented now.
The problem is that null and empty string have different meanings for the function I am reffering to.
null - > doesn't exist at all.
"" -> Is a technically valid option, Exists but is empty.
Thanks,
Maciej