Override abstract method upon instance creation in c#

.net, c#, java

Solution

This Java feature is called "anonymous class", not "an override of method on instance creation". There is no identical feature in C#.

C# took a different route - instead of providing convenience syntax for creation of subclasses, it expanded upon its delegate features, providing anonymous delegates and lambdas. Lambdas let you plug in pieces of code.

Problem

In java, we can override or implement abstract methods upon instance creation as follows: ``` AbstractClass test =new AbstractClass() { public void AbstractMethod(string i) { } public void AbstractMethod2(string i) { } }; ``` Is this possible in C#? if Yes, what's the equivalent code Thanks

Original source