Question: is there `MulDiv`

```
WINBASEAPI
int
WINAPI
MulDiv(
    _In_ int nNumber,
    _In_ int nNumerator,
    _In_ int nDenominator
    );

```

in C# or an equivalent to it?

or should I Implement it ?

Edit: with out PInvoking!!

Answer: 
This is an enhancement to Hans Passant sugestion, but including the +0.5 rounding as per MSDN docs:

```
public static int MulDiv(int number, int numerator, int denominator)
{
    return (int)(((long)number * numerator + (denominator >> 1)) / denominator);
}

```

**Note:** This code uses right-shift operator to obtain top performance.
If you want to make it clear that you're going out of your way to handle the case where two 32-bit integers may yield a value larger than a 32-bit integer, you could use Math.BigMul, then just divide the result and cast it back to an integer. I see, as stated by other answers, .NET's support for 64-bit integers apparently provides all the benefits you'd need that MulDiv formerly would have (and then some).

```
int result = unchecked((int)(System.Math.BigMul(nNumber, nNumerator) / nDenominator));

```