Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Which of these methods do you use, and why?

 

namespace some.longish.winded.name.space
{
   class something
   {
   }
}

 

or

 

namespace some
{
   namespace longish
   {
       namespace winded
       {
           namespace name
           {
               namespace space
               {
                   class something
                   {
                   }
               }
           }
       }
   }
}

 

Clearly the second approach leads to much greater level of indentation, which could be annoying on a small screen.

 

What advantages do you see to one over the other?

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

  • Administrators
Posted

I tend to use the first version when all classes in a file are part of the same namespace - it is less typing and easier to read.

 

If I have more than one namespace in a single file (not common and I don't think I've ever had more than one namespace plus a single nested namespace) then the second form can sometimes be more readable.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...