Class.Class vs Namespace.Class for top level general use class libraries?
Posted
by Joan Venge
on Stack Overflow
See other posts from Stack Overflow
or by Joan Venge
Published on 2010-03-15T19:20:21Z
Indexed on
2010/03/15
19:39 UTC
Read the original article
Hit count: 178
Which one is more acceptable (best-practice)?:
namespace NP
public static class IO
public static class Xml
...
// extension methods
using NP;
IO.GetAvailableResources ();
vs
public static class NP
public static class IO
public static class Xml
...
// extension methods
NP.IO.GetAvailableResources ();
Also for #2
, the code size is managed by having partial classes so each nested class can be in a separate file, same for extension methods (except that there is no nested class for them)
I prefer #2
, for a couple of reasons like being able to use type names that are already commonly used, like IO
, that I don't want to replace or collide.
Which one do you prefer? Any pros and cons for each? What's the best practice for this case?
EDIT: Also would there be a performance difference between the two?
© Stack Overflow or respective owner