Click here to Skip to main content
15,901,666 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there any way to minimize below code in .net framework 4.0
VB
Dim dblResult As Double
Dim dbloutput As Double
Dim lngFactor As Integer
lngFactor = 10 ^ intDecimalPlaces
dblResult = (dblNumber * lngFactor) + (0.5 * System.Math.Sign(dblNumber))

dblResult = Fix(dblResult)
dbloutput  = dblResult / lngFactor
Posted
Comments
Pheonyx 16-Jul-13 2:53am    
What exactly do you mean by minimize?
Zoltán Zörgő 16-Jul-13 8:43am    
You could make a single statement from the calculation, but won't gain a dime with it.

1 solution

I'm not sure what you want to achieve, but if you want "minimize" - means: reduce - the number of lines, try this:
VB
Dim dblResult As Double = 0R, dbloutput As Double = 0R, lngFactor As Integer = 0

lngFactor = 10 ^ intDecimalPlaces
dblResult = Fix((dblNumber * lngFactor) + (0.5 * System.Math.Sign(dblNumber)))/lngFactor
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900