Reputation: 25
Okay so I'm trying to convert a method from Java to c#, however modPow in C# takes 3 arguments, where as in Java it only takes 2? How can I convert the following to C# -
BigInteger var6 = var5.modPow(var1, var2);
Tried the following but it returns exceptions -
BigInteger var6 = var5.ModPow(var1, var2);
stating - DivideByZero Exception, ArgumentOutOfRangeException..
which is obviously due to the fact there's only 2 arguments instead of 3, however I don't want to add a blank argument as it may cause the functionality to not work correctly.
Upvotes: 0
Views: 113
Reputation: 119076
In Java the modPow
method is exposed against an instance of BigInteger
whereas in C# it is a static method on the BigInteger
class. See the docs for ModPow. This means you need to do this:
BigInteger var6 = BigInteger.ModPow(var5, var1, var2);
Upvotes: 1
Reputation: 48647
this
is the "missing" argument. When you'd do x.modPow(y, z)
in Java, do ModPow(x, y, z)
in C#.
Upvotes: 1