Which one is more acceptable (best-practice)?:
namespace NP
public static class IO
public static class Xml
...
// extension methods
using NP;
I
I would say #1. Because when you bundle up lots of classes into one static class you do the same thing as a namespace is meant for. Which is why I would say it is best to let namespaces do that for you.
In that case you can also get rid of having to write "NP" in front of everything by adding using in case you want. I think you should either nest your namespaces so that they wont collide or use more describing namespace names than IO.
Most often the best practice is what Microsoft does and I have never seen them do #2
I think you should avoid exposed (public) nested classes and interfaces, or at least that is what Microsoft FxCop would say. Thus, the first one is better.
Edit: (yes, changed to the first one, i shouldn't reply in SO when i'm dead tired)
I prefer #1 and let namespaces do it. Like others have said, it's very confusing to call into classes to get to other classes.
In addition, when you're doing more complex things like reflection or using something like a provider model, having nested classes being your actual provider section or the target you're attempting to reach becomes hairy.
Lastly, testing nested classes and interfaces make testing more difficult.
I've never seen your number 2 used. It reminds me of VB6 Modules.
The whole point of namespaces is that they are used to organise your code:
Namespaces are heavily used within C# programs in two ways. Firstly, the .NET Framework classes use namespaces to organize its many classes. Secondly, declaring your own namespaces can help control the scope of class and method names in larger programming projects.
When you look at the .NET framework itself, you can see that virtually everything is structured like your first example (namespaces), and virtually nothing is structured like your second example (nested types). The rare occasions that nested types are used are when they are so closely tied to the outer type that they are essentially part of it, but need to be a separate class for reasons such as code re-use.
So if by "best practice" you mean "using things for the purpose they were designed", "most like the .NET framework" and "corresponding most closely to .NET design paradigms" then there is no contest; use namespaces for organisation, not nested types.
Regarding your edit - no, there is no performance difference that will matter in the real world.
I prefer #1 because it does not require me to call through 1 class to get to another. I think it makes things a bit confusing because in general objects are meant to have member classes, methods, and such that deal directly with the objects made by instantiating the class. That means you are not really following the principles of OOP. Microsoft also says #1 is best practice.