Interface

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
C# Language Reference
edit
This page is under construction and not in a completed state. If you do not find here that which you seek, perform a search. For help with various kinds of searches, consult Searching. Image:UnderConstruction01.png

Interface is a core reference for the interface reference type in the C# language.

An interface is like a specification of a contract. It states what should be achieved but not exactly how the achievements should be met. When your class implements an interface, the complier knows your class accepts the contract. So, the complier will process all the methods defined by that interface. The beauty of this is that a black box definition is formed by the interface, and when multiple classes all implement this interface they become similar to use, making it easier for you—the programmer—to work with those classes.

Note: If your class does not conform to the contract then it will not compile.


Visual C# Best Practices

  • Begin the name of an interface with a capital I, as in ICloneable. The reasons for this are purely historical; but, to do otherwise is considered uncool. The Base Class Library interfaces are named using this convention.

See also


Personal tools