title: Redundant Casting in Visual studio
body: <p>Im working out a compression ratio and I noticed that I have a "Redundant Cast" in this line:</p>
  
  <pre><code>double ratio = (double)data.Length / (double)comp.Length;
  </code></pre>
  
  <p>Obviously dividing both array lengths without casting to double will return only the integer component of the number. </p>
  
  <p>But why is this cast redundant? </p>
  
  <p>Having just one cast on one Length removes the warning.</p>
  
  <p>To my understanding if we had:</p>
  
  <pre><code>double ratio = (double)data.Length / comp.Length;
  </code></pre>
  
  <p>or </p>
  
  <pre><code>double ratio = data.Length / (double)comp.Length;
  </code></pre>
  
  <p>wouldnt that then potentially cause another developer to get confused about what value is being calculated here.</p>
  
  <p>It seams to me that having an implicit cast can cause code readability issues. Especially in more complex one line calculations (which really is another readability question). </p>
  
  <p>I also thought casting values to different forms produce different outputs depending on where the cast is made in the equation.</p>