How to call extension method which has the same name as an existing method?

c#, extension-methods

Solution

You can't call the extension method as a normal extension method. The instance method overrides the extension method with the same signature

EDIT:

You can call it as a static method

ExtensionTest.MethodA(a);

Problem

I have code like ``` public class TestA { public string ColA { get; set; } public string ColB { get; set; } public string ColC { get; set; } public void MethodA() { MessageBox.Show("Original A1."); } } static class ExtenstionTest { public static void MethodA(this TestA A1) { MessageBox.Show("Extended A1."); } } ``` Now if I call MethodA like ``` TestA a = new TestA(); a.MethodA(); ``` It will always call Original method. How can I call the extension method.

Original source

Related problems