Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Most Popular/Frequently Used/Important Interfaces in C# .NET?

Tags:

c#

.net

Apart from IEnumerable, IComparable, what other "important" (or frequently used) interfaces are there for me to know in C#.NET?

like image 423
Shai UI Avatar asked Dec 19 '10 01:12

Shai UI


People also ask

What is the main use of interface in C#?

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.

What should be in an interface C#?

In C#, an interface can be defined using the interface keyword. An interface can contain declarations of methods, properties, indexers, and events. However, it cannot contain fields, auto-implemented properties. The following interface declares some basic functionalities for the file operations.

What is .NET interface?

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.

WHAT IS interface in .NET with example?

Like a class, Interface can have methods, properties, events, and indexers as its members. But interfaces will contain only the declaration of the members. The implementation of the interface's members will be given by class who implements the interface implicitly or explicitly.


2 Answers

Same question

Copy-Paste from there:

  • IEnumerable (and IEnumerable): for use with foreach and LINQ
  • IDisposable: for resources requiring cleanup, used with using
  • IQueryable: lets you execute requests against queriable data sources.
  • INotifyPropertyChange : For data binding to UI classes in WPF, winforms and silverlight
  • IComparable and IComparer: for generalized sorting
  • IEquatable and IEqualityComparer: for generalized equality
  • IList and ICollection: for mutable collections
  • IDictionary: for lookup collections
like image 188
The Smallest Avatar answered Oct 06 '22 03:10

The Smallest


IDisposable is pretty important.

like image 26
Richard Cook Avatar answered Oct 06 '22 01:10

Richard Cook