LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

passing a null reference to a string object ( .NET )

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.

 


0 Kudos
Message 1 of 3
(2,915 Views)

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.  Smiley Wink

Message Edited by smercurio_fc on 10-02-2008 09:28 AM
0 Kudos
Message 2 of 3
(2,897 Views)

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

Message Edited by Mac671 on 10-02-2008 11:18 AM

0 Kudos
Message 3 of 3
(2,887 Views)