Question

I started off creating a new project for each Server Control that I needed to create (for the purposes of flexibility and modularity). My latest project is a control that inherits TextBox in order to implement server-side enforcement of the MaxLength property, called SafeTextBox. So VS sets me up with my SafeTextBox project, with a class called ServerControl1 within the SafeTextBox namespace. Naturally I rename ServerControl1 to SafeTextBox. This creates the situation where, each time the class is referenced in code, I must type SafeTextBox.SafeTextBox.

Now that I have a few of these controls created, I am tempted to place them all into one assembly (CustomControls or similar), so that I could reference them as CustomControls.SafeTextBox, etc. Is there any reason that I should not do this? Is it possible to have multiple controls in one assembly?

Était-ce utile?

La solution

Is it possible to have multiple controls in one assembly?

YES, it is.

Is there any reason that I should not do this?

You should have all the related controls in a single project to start with.

Your initial approach to have a separate project for each control is not easy to manage and maintain. Usually all the related GUI controls are placed in a single project. That makes them easily accessible via one reference and also one do not ends up with lots of dlls for your application.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top