C# Program to Implement an Interface in a Structure Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report Structure is a value type and a collection of variables of different data types under a single unit. It is almost similar to a class because both are user-defined data types and both hold a bunch of different data types. We can create a structure by using struct keyword. A structure can also hold constructors, constants, fields, methods, properties, indexers, and events, etc. Syntax: public struct { // Fields // Methods }Interface is like a class, it can also have methods, properties, events, and indexers as its members. But interfaces can only have the declaration of the members. The implementation of the interface’s members will be given by the class that implements the interface implicitly or explicitly. Or we can say that it is the blueprint of the class. Syntax: interface interface_name { // Method Declaration in interface }Now given that two interfaces, now our task is to implement both interfaces in a structure. Approach: Create two interfaces named interface1 and interface2 with method declaration in it.Create a structure that implements these interfaces.struct GFG : interface1, interface2 { // Method definition for interface method // Method definition for interface method }Write the method definitions for both interfaces in the GFG struct.Inside the main method, create the two objects named M1 and M2.Call the methods of interface1 and interface2 using M1 and M2 object and display the output.Example: C# // C# program to illustrate how to implement // interface in a structure using System; // Interface 1 interface interface1 { // Declaration of Method void MyMethod1(); } // Interface 2 interface interface2 { // Declaration of Method void MyMethod2(); } // Structure which implement interface1 // and interface2 struct GFG : interface1, interface2 { // Method definitions of interface 1 void interface1.MyMethod1() { Console.WriteLine("interface1.Method() is called"); } // Method definitions of interface 2 void interface2.MyMethod2() { Console.WriteLine("interface2.Method() is called"); } } class Geeks{ // Driver code public static void Main(String[] args) { // Declare interfaces interface1 M1; interface2 M2; // Create objects M1 = new GFG(); M2 = new GFG(); M1.MyMethod1(); M2.MyMethod2(); } } Output: interface1.Method() is called interface2.Method() is called Comment More infoAdvertise with us Next Article Class Diagram | Unified Modeling Language (UML) S sravankumar_171fa07058 Follow Improve Article Tags : C# CSharp-Interfaces CSharp-programs Similar Reads Non-linear Components In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co 11 min read Spring Boot Tutorial Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance 10 min read Class Diagram | Unified Modeling Language (UML) A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact 12 min read Python Variables In Python, variables are used to store data that can be referenced and manipulated during program execution. A variable is essentially a name that is assigned to a value. Unlike many other programming languages, Python variables do not require explicit declaration of type. The type of the variable i 6 min read Spring Boot Interview Questions and Answers Spring Boot is a Java-based framework used to develop stand-alone, production-ready applications with minimal configuration. Introduced by Pivotal in 2014, it simplifies the development of Spring applications by offering embedded servers, auto-configuration, and fast startup. Many top companies, inc 15+ min read Backpropagation in Neural Network Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and 9 min read Polymorphism in Java Polymorphism in Java is one of the core concepts in object-oriented programming (OOP) that allows objects to behave differently based on their specific class type. The word polymorphism means having many forms, and it comes from the Greek words poly (many) and morph (forms), this means one entity ca 7 min read What is an Operating System? An Operating System is a System software that manages all the resources of the computing device. Acts as an interface between the software and different parts of the computer or the computer hardware. Manages the overall resources and operations of the computer. Controls and monitors the execution o 5 min read CTE in SQL In SQL, a Common Table Expression (CTE) is an essential tool for simplifying complex queries and making them more readable. By defining temporary result sets that can be referenced multiple times, a CTE in SQL allows developers to break down complicated logic into manageable parts. CTEs help with hi 6 min read Python Functions Python Functions is a block of statements that does a specific task. The idea is to put some commonly or repeatedly done task together and make a function so that instead of writing the same code again and again for different inputs, we can do the function calls to reuse code contained in it over an 9 min read Like