简体   繁体   English

如何将VB十六进制转换为C#十六进制

[英]How to Convert VB hex to c# hex

How do I convert this from VB.Net to c#? 如何将其从VB.Net转换为C#?

Dim dd As String = Hex(ExpiryDate.Value.Day).PadLeft(4, "0")

I tried a conversion tool (It uses the mono project source code they say) http://www.developerfusion.com/tools/convert/vb-to-csharp/ 我尝试了一个转换工具(它使用他们说的mono项目源代码) http://www.developerfusion.com/tools/convert/vb-to-csharp/

and it came up with this but c# does not like it. 它想出了这个,但C#不喜欢它。 - the code that is. -是的代码。

string dd = Conversion.Hex(ExpiryDate.Value.Day).PadLeft(4, "0");

This is the error:- 这是错误:

The name 'Conversion' does not exist in the current context

这可能是您想要的:

string dd = String.Format("{0:x4}", ExpiryDate.Value.Day);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM