[RESOLVED] IIF in VB.NET....C# = ???
VB Code:
Dim Growl As String = "This is some data"
Dim Woof As String = IIf(Growl.Trim = String.Empty, "Hi", "Bye")
What I have in C# is:
Code:
string Growl = "MyData";
string Woof = (Growl.Trim() = string.Empty ? "Hi" : "Bye");
But it squiggly blue lines the string.empty and says cannot convert to boolean.
Any ideas?
Woof
Re: IIF in VB.NET....C# = ???
fat lot of use you lot were :D
Code:
string Username = "MyData";
string Woof =(Username.Trim().Equals(string.Empty) ? "Hi" : "Bye");
Fixed :)
Woof
Re: [RESOLVED] IIF in VB.NET....C# = ???
That's because yuo are using an assignment operator instead of an equality operator. You need this:
Code:
string Woof = (Growl.Trim() == string.Empty ? "Hi" : "Bye");
One "=" is assignment, two "=" is equality.
Re: [RESOLVED] IIF in VB.NET....C# = ???
now you decide to post :D HAHAHAHA
Woooof
Re: [RESOLVED] IIF in VB.NET....C# = ???
A nineteen minute turn-around isn't too bad. I still haven't recovered from your collection thread. :D
Re: [RESOLVED] IIF in VB.NET....C# = ???
My collection class works perfectly..maybe a little unorthadox, but it wrks :D
I have an updated class now...you know I never do anything by halves ;)
Woof