
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
C# Equivalent to Java Functional Interfaces
Equivalent of Java’s Functional Interfaces in C# is Delegates.
Let us see the implementation of functional interface in Java −
Example
@FunctionalInterface public interface MyInterface { void invoke(); } public class Demo { void method(){ MyInterface x = () -> MyFunc (); x.invoke(); } void MyFunc() { } }
The same implementation in C# delagates −
Example
public delegate void MyInterface (); public class Demo { internal virtual void method() { MyInterface x = () => MyFunc (); x(); } internal virtual void MyFunc() { } }
- Related Articles
- Functional Interfaces in Java Programming
- What are the in-built functional interfaces in Java?
- How can we use lambda expressions with functional interfaces in Java?
- Interfaces in Java
- How to extend Interfaces in Java
- How to inherit multiple interfaces in Java?
- Evolution of interfaces in Java
- Interfaces and inheritance in Java Programming
- Can interfaces have constructors in Java?
- Java 8 default methods in interfaces
- Java 8 static methods in interfaces
- Callback using Interfaces in Java\n
- What are nested interfaces in Java?
- Private Methods in Java 9 Interfaces
- Why do we use interfaces in Java?

Advertisements