Search code examples
c#vbac#-4.0code-conversion

Format(rs.Fields(1), "#,###.00000") to C#


I'm converting some VBA code from Excel macro into C# and came across with this line of code.

VBA:

Format(12356, "#,###.00000")

How to translate this to C#?


Solution

  • You can try, ToString() with same format.

    var numStr = 12356.ToString("#,###.00000");
    Console.WriteLine(numStr);  //"12,356.00000"
    

    .Net Fiddle