What will be the equivalent code for Format(iCryptedByte, "000") (VB.NET) in C #?
Format(iCryptedByte, "000")
Try:
iCryptedByte.ToString("D3");
String.Format(format, iCryptedByte); // where format like {0:D2}
See MSDN 1 , 2 , 3
Another very useful site for formatting C # strings: http://blog.stevex.net/string-formatting-in-csharp/
Instead of {0:D3} you can also use a null placeholder, for example. {0:000} will be filled with zeros to a minimum length of three.
{0:D3}
{0:000}
Given this VB code:
Strings.Format(iCryptedByte, format)
Replace with this C # code:
var csformat = "{0:" + format + "}"; String.Format(csformat, iCryptedByte);
see String.Format
Microsoft.VisualBasic.Strings.Format(iCryptedByte, "000");
You need to add a link to the Microsoft.VisualBasic assembly.