title: What's the best way to create a percentage value from two integers in C#?
body: <p>I have two integers that I want to divide to get a percentage.</p>
  
  <p>This is what I have right now:</p>
  
  <pre><code>int mappedItems = someList.Count(x =&gt; x.Value != null);
  int totalItems = someList.Count();
  (int)(((double)mappedItems /(double) totalItems) * 100)
  </code></pre>
  
  <p>This gives the right answer.  But that is a lot of casting to do something as simple as get a percentage between two numbers.</p>
  
  <p>Is there a better way to do this?  Something that does not involve casting?</p>