I would like to know the translation of this java code in C#
n = (length > 0) ? Math.min(length, buffer.length) : buffer.length;//Java code
Can it be equivalent to this in C# ?
if(length >0)
{
n = Math.min(length, buffer.length);
}
else
{
n = buffer.length;
}
C# has the conditional operator as well.
In C#:
The only difference would be that method names are normally capitalized in .NET (PascalCase, instead of camelCase).
If you are going to be working with C#, I suggest taking a look at the available operators.