artmsft - ramdom programming tips
Showing posts with label
C#
.
Show all posts
Showing posts with label
C#
.
Show all posts
Wednesday, February 23, 2011
C# - Short cut for "If the value is null, assign the following value instead"
string errorMessage = obj.Message ?? "N/A";
Equals:
string errorMessage;
if (obj.Message == null)
{
errorMessage = "N/A";
}
else
{
errorMessage = obj.Message;
}
Older Posts
Home
Subscribe to:
Posts (Atom)