Reputation: 33
I have this line in code :
Avr_Hold_Time = (g.Sum(b => b.Field<int?>("QueueHoldCount")) == 0)
? 0
: (double)(g.Sum(b => b.Field<int?>("Avr_Hold_Time")))
/ (g.Sum(b => b.Field<int?>("QueueHoldCount")),
Which gives me floating number like 91.455678 I need to round up only 2 decimal after the point that rounds up after 3rd decimal number (e.g. 91.46) how can I do that ?
Upvotes: 0
Views: 9998
Reputation: 29846
Use Math.Round:
decimal num = 91.455678m;
var rounded = Math.Round(num, 2); // 91.46
Upvotes: 2