I tried searching for the most used built-in interfaces in C#, but couldn't find an article, so I thought we may recap here.
Let's use the following convention in the answers:
IinterfaceName1: for this
IinterfaceName2: for that
An interface contains definitions for a group of related functionalities that a non-abstract class or a struct must implement. An interface may define static methods, which must have an implementation. Beginning with C# 8.0, an interface may define a default implementation for members.
An interface may not declare instance data such as fields, auto-implemented properties, or property-like events. By using interfaces, you can, for example, include behavior from multiple sources in a class. That capability is important in C# because the language doesn't support multiple inheritance of classes.
An interface is a specification for a set of class members, not an implementation. An Interface is a reference type and it contains only abstract members such as Events, Methods, Properties etc. It contain only declaration for its members and implementation defined as separate entities from classes.
Types of user interfacesgraphical user interface (GUI) command line interface (CLI) menu-driven user interface. touch user interface. voice user interface (VUI)
The top two in my mind have to be ones with language support:
IEnumerable<T>
(and IEnumerable
): for
use with foreach
and LINQIDisposable
: for resources requiring
cleanup, used with using
Beyond that...
IComparable<T>
and IComparer<T>
: for generalized sortingIEquatable<T>
and IEqualityComparer<T>
: for generalized equalityIList<T>
and ICollection<T>
: for mutable collectionsIDictionary<T,K>
: for lookup collectionsINotifyPropertyChange
: For data binding to UI classes in WPF, winforms and silverlight
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With