How to Truncate decimal values in C#

Asked

Viewed 61 times

1

I am trying to truncate the values (without rounding) according to the number of decimals passed per parameter, but the Math.Truncate function does not have this feature... Is there any way I can do this?

public static decimal TruncarValor(decimal valor, int casasDecimais)
{
   return Math.Truncate(valor, casasDecimais????????);
}

Hug to all!

  • 1

    Master, would that help you? https://answall.com/questions/238660/como-truncar-decimal-x-casas-decimal

  • 1

    Help yes!!! Thank you!! Comment on the main post that I will define as a reply :)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.