<p>I noticed in another post, someone had done something like:</p>

<pre><code>double d = 3.1415;
int i = Convert.ToInt32(Math.Floor(d));
</code></pre>

<p>Why did they use the convert function, rather than:</p>

<pre><code>double d = 3.1415;
int i = (int)d;
</code></pre>

<p>which has an implicit floor and convert.</p>

<p>Also, more concerning, I noticed in some production code I was reading:</p>

<pre><code>double d = 3.1415;
float f = Convert.ToSingle(d);
</code></pre>

<p>Is that the same as:</p>

<pre><code>float f = (float)d;
</code></pre>

<p>Are all those otherwise implicit conversions just in the Convert class for completeness, or do they serve a purpose? I can understand a need for .ToString(), but not the rest.</p>

You can use Convert when you have a string that you want to convert to an int
```
```
int i = Convert.ToInt32("1234");
```
```
Convert and casting will both throw an exception if they fail.
i.e, this will still throw an exception, it will not return 0:
```
```
Convert.ToInt32("1234NonNumber");
```
```
In many cases Convert and casting will have the same result, but a cast is often times easier to read.