Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a .NET library, with some WebControls.

These webControls have Embed Resources.
And we declare them like it, in all webcontrols for each cs file:

Something like this:

 [assembly: WebResource("IO.Css.MyCSS.css", "text/css")]
    namespace MyNamespace.MyClass
         public class QuickTip : Control, INamingContainer
        //My code...

Would it be a good idea to create a cs file and include all WebResource declarations there?

Example a cs file with just:

     [assembly: WebResource("IO.Css.MyCSS.css", "text/css")]
     [assembly: WebResource("IO.Image.MyImage.png", "image/png")]
//And many other WebResources of all WebControls of the Assembly
share|improve this question
did you consider asking at Code Review.SE? – gnat Apr 19 '12 at 15:50
@gnat I don't think this is regarding code style but rather architectural decisions. – Neil Apr 19 '12 at 15:59
This is an architectural question, and as such is off topic on Code Review. – Michael K Apr 19 '12 at 20:37
@MichaelK, how to move this question do Code Review site? – Guilherme J Santos Apr 20 '12 at 13:02
GuilhermeJSantos We won't be migrating it to Code Review, as @MichaelK already mentioned it's off topic for them. – Yannis Apr 20 '12 at 13:58

In general, this is not a good practice. You want to be able to add or remove features in as few operations as possible, touching as few files as possible. Ideally you want to be able to add a feature without modifying any existing files.

Think about reusing just one of these web controls in another application, and it becomes pretty clear.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.