Question: I am wondering if there is a special method/trick to check if a `String` object is null. I know about the [`String.IsNullOrEmpty`](http://msdn.microsoft.com/en-us/library/system.string.isnullorempty.aspx) method but I want to differentiate a `null` String from an empty String (=`""`).

Should I simply use:

```
if (s == null) {
    // blah blah...
}

```

...or is there another way?

Answer: 
You can use the null coalescing double question marks to test for nulls in a string or other nullable value type:

```
textBox1.Text = s ?? "Is null";

```

The operator '??' asks if the value of 's' is null and if not it returns 's'; if it is null it returns the value on the right of the operator.

More info here:
<https://msdn.microsoft.com/en-us/library/ms173224.aspx>

And also worth noting there's a null-conditional operator ?. and ?[ introduced in C# 6.0 (and VB) in VS2015

```
textBox1.Text = customer?.orders?[0].description ?? "n/a";

```

This returns "n/a" if description is null, or if the order is null, or if the customer is null, else it returns the value of description.

More info here:
<https://msdn.microsoft.com/en-us/library/dn986595.aspx>
If you are using `C# 7.0` or above you can use `is null`:

```
if (s is null) {
    // blah blah...
}

```

Also, note that when working with strings you might consider also using `IsNullOrWhiteSpace` that will also validate that the string doesn't contain only spaces.