Gopher2011
Gopher2011

Reputation: 179

How to Convert VB hex to c# hex

How do I convert this from VB.Net to 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/

and it came up with this but c# does not like it. - 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

Upvotes: 0

Views: 3125

Answers (1)

bbarnickel
bbarnickel

Reputation: 76

This might be what you want:

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

Upvotes: 6

Related Questions