Compiler Error CS0121 The call is ambiguous between the following methods or properties: 'TestMethod' and 'TestMethod'
The compiler was not able to call one form of an overloaded method. In other word Compiler can not decide which overload method should use.
C# Code
public class Parent { public double Add(int i, double d) { return (double)i + d; } public double Add(double d, int i) { return d + (double)i; } }
Call above function from Main function
static void Main(string[] args) { Parent p1 = new Parent(); double result1 = p1.Add(1, 2.2); // result1 = 3.2 double result2 = p1.Add(1.1, 2); // result1 = 3.1 double result3 = p1.Add(1, 2); // Get Compiler Error CS0121 Console.ReadKey(); }
Your blog is very interesting. Thank you for your sharing this post. I want more information in your blog...!
ReplyDeleteMS Azure Online Training