C# Selecting a different method to the one expected with optional parameters and multiple levels of inheritance
问题 In the given example (sorry for code style, it was in the interest of a compact self-contained repro), the method called is always the virtual method in B that has the additional integer parameter, while I would expect that the method implemented in C would be the one called. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MethodChoosing { class Program { static void Main(string[] args) { C c = new C(); c.M(); Console.ReadKey(); } } public class