最小化Dotnet代码 [英] Minimize Dotnet code

查看:95
本文介绍了最小化Dotnet代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在.net framework 4.0中最小化以下代码

  Dim  dblResult  As   Double  
Dim dbloutput As Double
Dim lngFactor 作为 整数
lngFactor = 10 ^ intDecimalPlaces
dblResult =(dblNumber * lngFactor)+( 0 5 * System.Math。签名(dblNumber))

dblResult =修复(dblResult)
dbloutput = dblResult / lngFactor

解决方案

< blockquote>我不确定你想要实现什么,但如果你想要最小化 - 意味着:减少 - 行数,试试这个:

 < span class =code-keyword> Dim  dblResult  As   Double  = 0R,dbloutput 正如  Double  = 0R,lngFactor  As   Integer  =  0  

lngFactor = 10 ^ intDecimalPlaces
dblResult = Fix((dblNumber * lngFactor)+( 0 5 * System.Math.Sign( dblNumber)))/ lngFactor


Is there any way to minimize below code in .net framework 4.0

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

解决方案

I'm not sure what you want to achieve, but if you want "minimize" - means: reduce - the number of lines, try this:

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


这篇关于最小化Dotnet代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆