I want to force the root namespace to the contents of any .cs source files that do not have their contents enclosed in an explicit namespace . In other words, I want to save classes and other space level structures from the default namespace.
(Work inside Windows.NET with Visual Studio)
In the following example, I want to force the Car class into the MotorIndustry namespace by MotorIndustry , although it does not have an explicit namespace.
Vehicle.cs (has a namespace)
namespace MotorIndustry { public class Vehicle {
Car.cs (no namespace / default)
public class Car : Vehicle {
Is there a way to accomplish this โroot namespaceโ behavior using the project settings in Visual Studio, the AssemblyInfo.cs file, or some other means?
My understanding of VB.NET has such a function, but does C # act differently?
In some context, why I ask about this: I have hundreds of classes, and the programmer forgot to wrap the namespace around some. When I refer to an assembly from other projects, it pollutes the default namespace with classes, which ultimately cause some ambiguous situations.
source share