# ToStr(Boolean)

{% code title="Declaration" %}

```csharp
public static string ToStr(this object value, bool safe = true)
```

{% endcode %}

<pre class="language-csharp" data-title="Example"><code class="lang-csharp">object validObjectString = "Hello World!";
object nullObject = null;
<strong>
</strong>validObjectString.ToStr(true);

nullObject.ToStr(true);
nullObject.ToStr(false);
</code></pre>

{% code title="Result" %}

```csharp
"Hello World!"

""
NullReferenceException
```

{% endcode %}
