2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Visual Studio 2015 C#] クイックアクションの「○○を通じてインターフェイスを実装します」がかなり便利

Posted at
sample.cs
class Main : ITest
{
    Test test = new Test();

}

class Test : ITest
{
    public string function()
    {
        return "test";
    }

}

interface ITest
{
    string function();
}

委譲したクラス(Testクラス)に対して、委譲した機能(ITestインターフェイス)を外側から見たときに、
分からないようにする(簡単にアクセスしたい)場合には、クイックアクションの「○○を通じてインターフェイスを実装します」がかなり便利。

上記の例だと、Mainの横のITestに対して、クイックアクションを実行すれば、functionをTestインスタンスを用いて自動生成してくれる。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?