开发者

How to customize the method templates in Visual Studios

Is there a way to customize/edit the default template of the event handling methods in Visual Studios 2008/2010 such that upon creation, the event handler already has a try/catch block in it?

the default behavior is

    private void button1_Click(object sender, EventArgs e)
    {
    }

I'd like to be able to set the development environment to do

    private void button1_Click(object sender, EventArgs e)
    {
        try
        {
            ///TODO: Add logic here
        }
        catch
        {
            throw;
        }
        finally
        {
        }
    }

I've already edited the templates located in the ItemTemplates folder so that they meet the coding standard where I work, but I'd also like to edit the method templates if possible. I've searched the 'Net for the better part of a week and found nothing. Any assistance would be greatl开发者_C百科y appreciated.


![Snippet Manager1

Have you considered Editing Event method stub in the Code Snippet manager or adding a new snippet?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜