To be precise, check for both "dictionary" being null and "dictionary.value" being null:

``` csharp
if (dictionary == null)
                return "{}";
            else
                return "{" + string.Join(",", dictionary.Select(kv => kv.Key.ToString() + "=" + (kv.Value == null ? string.Empty : kv.Value.ToString())).ToArray()) + "}";
```