tags:

views:

102

answers:

5

What will be the equivalent code for Format(iCryptedByte, "000") (VB) in C# ?

Thanks

+7  A: 
String.Format(format, iCryptedByte); // where format like {0:D2}

See MSDN 1, 2, 3

abatishchev
A: 

see String.Format

Louis Rhys
+1  A: 

IF you're new to C#, this may also help:

http://www.harding.edu/fmccown/vbnet_csharp_comparison.html

SteveCav
A: 

Try:

iCryptedByte.ToString("D3");
pm_2
Depends on `iCryptedByte` type. if it's `int` - yes, `ToString(string)` exists
abatishchev
Why the downvote?
pm_2
+2  A: 

Another very useful site for C# string formatting: http://blog.stevex.net/string-formatting-in-csharp/

Instead of {0:D3} you can also use the zero placeholder, e.g. {0:000} will pad with zeros to minimum length of three.

Peet Brits