帮助解码VB代码 [英] Help decoding VB code

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

问题描述

大家好,



我不得不将一些旧的VB代码翻译成C#,而且我对这一组陈述感到有点难过。我不需要知道输出字符串是什么,代码将通过此语句采用哪条路径(以及为什么!)。



Hi guys,

I''m having to translate some old VB code into C#, and I''m a bit stumped on this one set of statements. I don''t need to know what the output string would be, just which route the code would take through this statement (and why!).

Select Case True
  Case Not IsNumeric(strValue)
    strValue = Format$(Now, "dd-mmm-yyyy")
  Case CDbl(strValue) = 0
    strValue = Format$(Now, "dd-mmm-yyyy")
  Case Else
    strValue = Format$(DateSerial(Left(strValue, 2), Mid(strValue, 3, 2), Right(strValue, 2)), "dd-mmm-yyyy")
End Select





前两个Case语句都返回相同的值,所以对我来说没有意义我应该如何将其转换为C#。有任何想法吗?



非常感谢。



The first two Case statements both return the same value regardless, so it makes no sense to me how I should really be translating this into C#. Any ideas?

Many thanks.

推荐答案

(现在, dd-mmm-yyyy
案例 CDbl (strValue)= 0
strValue =格式
(Now, "dd-mmm-yyyy") Case CDbl(strValue) = 0 strValue = Format


(现在,< span class =code-string> dd-mmm-yyyy
案例 其他
strValue =格式
(Now, "dd-mmm-yyyy") Case Else strValue = Format


(DateSerial(Left(strValue, 2 ),Mid(strValue, 3 2 ),右( strValue, 2 )), dd-mmm-yyyy
结束 选择
(DateSerial(Left(strValue, 2), Mid(strValue, 3, 2), Right(strValue, 2)), "dd-mmm-yyyy") End Select





冷杉无论如何,两个Case语句都返回相同的值,因此对于我应该如何将其转换为C#没有任何意义。有任何想法吗?



非常感谢。



The first two Case statements both return the same value regardless, so it makes no sense to me how I should really be translating this into C#. Any ideas?

Many thanks.


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

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