I’m trying to overload a method in C# with the same number of parameters but different types.
private double scale(double value)
{
return value * 100 / scale;
}
private float scale(float value)
{
return value * 100 / scale;
}
but I get this error
Error 4 The type ‘[className]’ already
contains a definition for ‘scale’
NOTE: I’m working in MVS 2008
Thank you.
This code doesn’t make sense:
return value * 100 / scale;If you have a method name
scale, then what does thescaleat the end of the line do?Your Method Signature is semantically correct, as this is perfectly legal C# code:
It seems that you also have a field or property named
scalein your class:private float scale = 0.15f;