T
TomC
I know this is long, but please bear with me.
I'm coming from a Java background and trying to get familiar with C#
and Visual Studio for my own benefit. To accomplish that, I have been
doing some experimenting, writing trivial apps to test my
understanding of things.
My latest experiment worked, but NOT in the way that I had
anticipated. I suspect that my question may be as much about VS as it
is about C#. I'll get to the question shortly, but first let me
describe what I have done.
More or less as an intellectual exercise I have created a couple of
trivial applications and gave them the same project name, but
different solution names. The first application was a CONSOLE
application which I gave the highly inventive name
"CircleApplication". I called the solution "CircleDriver".
In this project, I added another class that I called the Circle
class. As the name implies, it merely represents a Circle (I said the
app was trivial) with a couple of instance fields (radius and
unitOfMeasure). Naturally, I created a constructor, a couple of
properties and methods. After I got the Circle class working, I used
Program.cs as a driver to test it and everything worked as expected.
After that, I closed my solution and created a new WINDOWS project. I
also called this one "CircleApplication", so it would be in the same
namespace as the Circle class, but named the solution "CircleGUI". I
added a reference to the Circle class, and used the form to create a
simple GUI where I could enter in the radius and unit of measure, and
output the Circumference and Area. Fired it up, and everything worked
like a charm.
When I added the reference to the Circle class, I expected to see one
folder called CircleApplication representing the namespace, with two
project folders inside it. Instead, I had TWO new folders in my
Projects folder ("CircleDriver" and "CircleGUI"), and EACH had a
folder inside named "CircleApplication". I also noticed that a copy
of Circle.cs had been placed in the folder containing my GUI.
As I see things, if I create a project with ten classes (not counting
the GUI), and I want to test each class individually before creating
the main project, like I did the Circle class, I am going to end up
with ten folders, all containing a folder with the same name as the
namespace.
And then when I create the GUI and tie it all together, I'll end up
with an eleventh folder, also containing a subfolder named to match
the namespace, and VS will copy all of the source code files that I
reference over to this folder.
OK, here comes the question.
Is that the way things are done in C#/Visual Studio?
I'm coming from a Java background and trying to get familiar with C#
and Visual Studio for my own benefit. To accomplish that, I have been
doing some experimenting, writing trivial apps to test my
understanding of things.
My latest experiment worked, but NOT in the way that I had
anticipated. I suspect that my question may be as much about VS as it
is about C#. I'll get to the question shortly, but first let me
describe what I have done.
More or less as an intellectual exercise I have created a couple of
trivial applications and gave them the same project name, but
different solution names. The first application was a CONSOLE
application which I gave the highly inventive name
"CircleApplication". I called the solution "CircleDriver".
In this project, I added another class that I called the Circle
class. As the name implies, it merely represents a Circle (I said the
app was trivial) with a couple of instance fields (radius and
unitOfMeasure). Naturally, I created a constructor, a couple of
properties and methods. After I got the Circle class working, I used
Program.cs as a driver to test it and everything worked as expected.
After that, I closed my solution and created a new WINDOWS project. I
also called this one "CircleApplication", so it would be in the same
namespace as the Circle class, but named the solution "CircleGUI". I
added a reference to the Circle class, and used the form to create a
simple GUI where I could enter in the radius and unit of measure, and
output the Circumference and Area. Fired it up, and everything worked
like a charm.
When I added the reference to the Circle class, I expected to see one
folder called CircleApplication representing the namespace, with two
project folders inside it. Instead, I had TWO new folders in my
Projects folder ("CircleDriver" and "CircleGUI"), and EACH had a
folder inside named "CircleApplication". I also noticed that a copy
of Circle.cs had been placed in the folder containing my GUI.
As I see things, if I create a project with ten classes (not counting
the GUI), and I want to test each class individually before creating
the main project, like I did the Circle class, I am going to end up
with ten folders, all containing a folder with the same name as the
namespace.
And then when I create the GUI and tie it all together, I'll end up
with an eleventh folder, also containing a subfolder named to match
the namespace, and VS will copy all of the source code files that I
reference over to this folder.
OK, here comes the question.
Is that the way things are done in C#/Visual Studio?