Which one is more acceptable (best-practice)?:
namespace NP
public static class IO
public static class Xml
...
// extension methods
using NP;
I
I actually find myself using #2 sometimes. I'll get into why after the next line. But in your case with empty static classes, namespaces are more ideal because that is what they are for.
However, if you have an use case where you are deriving new classes, some times it may make sense to nest these derived classes.
For example, you could have:
public abstract class Vehicle
{
int NumberOfWheels;
}
public class SportsCar : Vehicle
{
}
Now, you may want to put them both under Vehicle namespace so that the parent is not cluttered with all the different derived classes. However, that's a bad idea.
Instead, nesting them gives you all the benefits:
public abstract class Vehicle
{
int NumberOfWheels;
public class SportsCar : Vehicle
{
}
}