Coalesce goes C# « Only Talking Sense
... the null-coalescing operator in C# 2.0.
string name = (userName == null? “” : userName);
There’s nothing wrong with this code ....but the ternary operator ?
you can now write
string name = userName ?? “”;
Powered by ScribeFire.
No comments:
Post a Comment