views:

36

answers:

1

Hi

I have some code I want to insert into several classes but I don't want to do it manually, is there a way to automate this in visual studio 2008?

Can you remove code from several files in a similiar way?

thanks

+2  A: 

Visual Studio has a Macro feature that you might want to take a look at.

While I don't know what your specific scenario is, I would always be a bit concerned if a requirement like this comes up, because it sound like code duplication.

On the other hand, if you want to do this because you wish to provide certain templates, Visual Studio has this feature as well. You can create new file templates or edit the existing ones.

With templates, however, you can't remove code, so in that case, you would have to resort to writing (or recording) a macro.

Mark Seemann