Interfaces in C#

What are Interfaces in C# ? Interface is similar to a class, but only specifies the behaviour of what it does instead of storing data. So let us explore what an interface is with an analogy. So let’s imagine we have a restaurant menu as an interface. The menu lists a variety of dishes the customer can order.The kitchen team knows how to prepare each dish in the menu’s description as per the interface contract....

September 20, 2023 · 7 min

The static keyword in C#

The article is about the static keyword in c# A static method or field is one that belongs to the class and no instance can have access to the member and methods. Let’s create an example public class Account { private static int minAge = 18; private static int minIncome = 10000; public static bool AccountAllowed (decimal income, int age) { if (income > minIncome && age >= minAge) { return true; }else { return false; } } } Here we have a static method AccountAllowed....

September 15, 2023 · 2 min