2014-04-07 63 views
0

我有interface定義在C#.是否有任何工具來自動創建(生成)該接口的所有空方法與默認返回類型? 例如我已經有:C#從接口生成代碼

interface ISampleInterface 
{ 
    void SampleMethod(); 
    int func(int); 
} 

,我想:

// auto interface member implementation: 
class ImplementationClass : ISampleInterface 
{ 

    void ISampleInterface.SampleMethod() 
    { 

     return; 
    } 

    // changed return type to int according to interface definintion 
    int ISampleInterface.func(int a) 
    { 

     return a; 
    } 

} 
+1

resharper應該做 – csharpwinphonexaml

+1

考慮「重新銳利」的工具。 – FosterZ

+0

Resharper應該做 –

回答

0

只需右鍵點擊你的class ImplementationClass : ISampleInterface並點擊Implement Interface

,否則你可能會考慮使用Re-sharper工具

+0

只適用於特定版本的Visual Studio – csharpwinphonexaml

+1

@verdesrobert: - 更新了我的答案! –

+1

@ user3414693謝謝! – zeus2