Search code examples
c#.netpow

Strange casting in VB in Math.Pow


This code is working fine

Dim bc As Long = Math.Pow(36, ((IBase36.Length - 1) - i))

! Under VB Math.Pow return DOUBLE data type.

When I convert it into C# I have got

long bc = Math.Pow(36, ((IBase36.Length - 1) - i));

And I have a cast syntax issue.

How it could be resolved?


Solution

  • long bc = (long)Math.Pow(36, ((IBase36.Length - 1) -i));
    

    () is the cast operator in C#.