As a preface, I don't think it's very good organization to have
mutliple classes in the same text file. I would try separating them
out by directory, something like this:
ProjectDirectory
Source
Namespace1
Class1.cs
Namespace2
Class1.cs
Bin
Doc
you get the idea...
But if you do wish to put two classes into the same file, here's what
I did:
The way I did it originally was just to type the 2nd namespace into
the default Class1.cs file of the project, and then compile it. Is
this what you are doing? How does the IDE protest? When you compile?
If you have a file called Class1.cs with two classes in it (like my
previous post) I can add it to a new project (one that does not have a
Class1.cs) as follows:
In solution explorer:
Right click on the project name:
Add existing item
Pick Class1.cs from the dialog
It adds it just fine.
Also, I can add a new class into an existing file with the wizard.
Goto class view. You'll see the namespaces. You can add a third
class into the file:
Right click on the project
Add | class
Enter the following: Class: Class1, Namespace: Namespace3
Hit ok
It prompts me: Class1.cs already exists. Do you want to merge to it?
I hit yes.
mike
"Jan Michalski" <ja***********@blueyonder.co.uk> wrote in message
news:zu******************@news-binary.blueyonder.co.uk...
Dear Michael,
The file structure I have is the same as yours.
Can you briefly outline how you incorporate this file into your
project.When I create my project it automatically creates a
namespace with the same name as the project name. And I cannot see how to
incorporate further namespaces. I have tried to add two classes with the same
name but different namespaces. And then the IDE protests. Clearly this
approach must be incorrect. How do you do it?
Regards,
Jan