<p>I want to assign the decimal variable &quot;trans&quot; to the double variable &quot;this.Opacity&quot;.</p>
<pre class="lang-cs prettyprint-override"><code>decimal trans = trackBar1.Value / 5000;
this.Opacity = trans;
</code></pre>
<p>When I build the app it gives the following error:</p>
<blockquote>
<p>Cannot implicitly convert type decimal to double</p>
</blockquote>

An explicit cast to
```
double
```
like this isn't necessary:
```
```
double trans = (double) trackBar1.Value / 5000.0;
```
```
Identifying the constant as
```
5000.0
```
(or as
```
5000d
```
) is sufficient:
```
```
double trans = trackBar1.Value / 5000.0;
double trans = trackBar1.Value / 5000d;
```
```