.net - What's the best way to create a percentage value from two integers in C#? -


I have two integers that I want to split to get the percentage.

I have it right now:

  int mapped items = some list. Count (x => x.Value! = Null); Int totalItems = someList.Count (); (Integer) (((double) mapped item / (double) total rectangles) * 100)  

This gives the correct answer. But this is very easy to do, because one percent gets between two numbers.

Is there a better way to do this? Something that does not include casting?

How simply mapped items * 100.0 / total items and it is appropriate Casting for type?


Comments

Popular posts from this blog

objective c - iPhone and it's wireless area -

unix - Listing all shared memory segments used by a process on AIX5.3+ -

tsql - Correct sql/hql query (aggregate in where clause) -