0

I have been given some criteria for a project. It MUST be constructed in a particular way. I know this isn't a great question but my C# is really rusty. The specification states:

Application namespaces should follow (but not be limited to) the below [actual names changed]:

AnExample.Sample.Foo
AnExample.Sample.Foo.UnitTests
AnExample.Sample.Bar
AnExample.Sample.Bar.UnitTests

and that "each namespace should exist within its own assembly".

I'm a little confused- what is being asked for and how to achieve it? For each namespace to exist in it's "own assembly" does it have to be a separate project and referenced or is it a folder structure?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Jon Wells
  • 4,191
  • 9
  • 40
  • 69
  • 2
    Each project is compiled to one assembly (DLL or EXE file) – SLaks Jun 30 '13 at 19:06
  • might be applicable for: http://stackoverflow.com/questions/218123/what-was-the-strangest-coding-standard-rule-that-you-were-forced-to-follow :) – argaz Jun 30 '13 at 19:15
  • 1
    I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Jun 30 '13 at 19:23
  • SLaks said it. Each C# project (`.csproj` file) is compiled in one "go" and becomes one [assembly (follow link)](http://msdn.microsoft.com/en-us/library/k3677y81.aspx). An assembly is often a `.dll` or `.exe` file, possibly with other related files, like a `.pdb`. – Jeppe Stig Nielsen Jun 30 '13 at 19:25

2 Answers2

11

each namespace would have to be in its own project (.csproj)

within your projects, you could have whatever folder structure you wanted, as along as the namespace in the entire project is the same.

Kevin Nacios
  • 2,843
  • 19
  • 31
1

Basically, what they're asking you for is that each namespace is in its own separate file.

A project compiles to an assembly, which can be a .dll or an .exe. What they're saying is that each separate namespace should be in a separate project, so it compiles to a separate file. This is good for decoupling. You can then bring them all together using the Add Reference... button in VS.

It'sNotALie.
  • 22,289
  • 12
  • 68
  • 103