Home > Code Generation > Creating interface implementers with CodeRush

Creating interface implementers with CodeRush

June 1st, 2012

A class that implements an interface should implement all members of that interface. Members of implemented interfaces can be declared in two ways: implicit or explicit. That is why there are two versions of the Create Implementer code provider in CodeRush:

  • Create Implementer (implicit)
  • Create Implementer (explicit)

The Create Implementer (implicit) code provider creates a class that implements an interface implicitly. You can apply this code provider on the interface itself by placing the editor caret at the name of the interface:

CodeRush Create Implementer on interface

or on the reference to the interface in the code:

CodeRush Create Implementer on reference

The newly declared implementer is placed according to the Type Declarations code style settings. Here is the implementer code after code provider is performed (implicit version):

CodeRush Create Implementer implicit result

The second version of the code providers does the same as the first version, but implements an interface members explicitly:

CodeRush Create Implementer explicit result

—–
Products: CodeRush Pro
Versions: 11.2 and up
VS IDEs: 2008 and up
Updated: Jun/01/2012
ID: C164

Similar Posts:

  1. June 6th, 2012 at 01:59 | #1

    Hi Alex. I have translated your nice article and published on the following URL:
    http://d.hatena.ne.jp/gsf_zero1/20120607/p1
    Arigato!,

  2. June 6th, 2012 at 03:34 | #2

    @Hideaki Thank you!