.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

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -