IT. Expert System.

C#

Interface declarations


An interface-declaration is a type-declaration that declares a new interface type.

interface-declaration:
attributesopt interface-modifiersopt partialopt interface identifier type-parameter-listopt
interface-baseopt type-parameter-constraints-clausesopt interface-body ;opt

An interface-declaration consists of an optional set of attributes , followed by an optional set of interface-modifiers , followed by an optional partial modifier, followed by the keyword interface and an identifier that names the interface, followed by an optional type-parameter-list specification , followed by an optional interface-base specification , followed by an optional type-parameter-constraints-clauses specification , followed by a interface-body , optionally followed by a semicolon.

      1. Interface modifiers

An interface-declaration may optionally include a sequence of interface modifiers:

interface-modifiers:
interface-modifier
interface-modifiers interface-modifier

interface-modifier:
new
public
protected
internal
private

It is a compile-time error for the same modifier to appear multiple times in an interface declaration.

The new modifier is only permitted on interfaces defined within a class. It specifies that the interface hides an inherited member by the same name, as described in §10.3.4.

The public, protected, internal, and private modifiers control the accessibility of the interface. Depending on the context in which the interface declaration occurs, only some of these modifiers may be permitted .

      1. Partial modifier

The partial modifier indicates that this interface-declaration is a partial type declaration. Multiple partial interface declarations with the same name within an enclosing namespace or type declaration combine to form one interface declaration, following the rules specified in §10.2.

      1. Base interfaces

An interface can inherit from zero or more interface types, which are called the explicit base interfaces of the interface. When an interface has one or more explicit base interfaces, then in the declaration of that interface, the interface identifier is followed by a colon and a comma separated list of base interface types.

interface-base:
: interface-type-list

For a constructed interface type, the explicit base interfaces are formed by taking the explicit base interface declarations on the generic type declaration, and substituting, for each type-parameter in the base interface declaration, the corresponding type-argument of the constructed type.

The explicit base interfaces of an interface must be at least as accessible as the interface itself . For example, it is a compile-time error to specify a private or internal interface in the interface-base of a public interface.

It is a compile-time error for an interface to directly or indirectly inherit from itself.

The base interfaces of an interface are the explicit base interfaces and their base interfaces. In other words, the set of base interfaces is the complete transitive closure of the explicit base interfaces, their explicit base interfaces, and so on. An interface inherits all members of its base interfaces. In the example

interface IControl
{
void Paint();
}

interface ITextBox: IControl
{
void SetText(string text);
}

interface IListBox: IControl
{
void SetItems(string[] items);
}

interface IComboBox: ITextBox, IListBox {}

the base interfaces of IComboBox are IControl, ITextBox, and IListBox.

In other words, the IComboBox interface above inherits members SetText and SetItems as well as Paint.

A class or struct that implements an interface also implicitly implements all of the interface’s base interfaces.

      1. Interface body

The interface-body of an interface defines the members of the interface.

interface-body:
{ interface-member-declarationsopt }



Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 84 / 158781123. Delta: 0.04603 с