Home >Backend Development >C#.Net Tutorial >C# equivalent of Java functional interfaces
#Java’s functional interface is equivalent to Delegate in C#.
Let us see the implementation of functional interface in Java -
@FunctionalInterface public interface MyInterface { void invoke(); } public class Demo { void method(){ MyInterface x = () -> MyFunc (); x.invoke(); } void MyFunc() { } }
C# The same implementation in Delay -
public delegate void MyInterface (); public class Demo { internal virtual void method() { MyInterface x = () => MyFunc (); x(); } internal virtual void MyFunc() { } }
The above is the detailed content of C# equivalent of Java functional interfaces. For more information, please follow other related articles on the PHP Chinese website!