Here's a useful operator I didn't know about.
I knew that this:
if (myValue != null)
{
myOtherValue = myValue;
}
else
{
myOtherValue = string.Empty;
}
Could be turned into:
myOtherValue = (myValue != null) ? myValue : string.Empty;
but you can use the ?? operator if you are just checking for null:
myOtherValue = myValue ?? string.Empty;
Same thing, to the right of the ?? if its null, to the left if its not.