CodeKingPlusPlus
CodeKingPlusPlus

Reputation: 16081

using a namespace in c#

I am creating a game for windows phone in C# and I want to test out some output and other data through the console. How do I include the classes (or the namespace) from the phone application into a console project?

Upvotes: 4

Views: 574

Answers (2)

Keith Nicholas
Keith Nicholas

Reputation: 44316

with using eg

using MyGameStuff;

or if you don't do that, in your code...

var sprite = new MyGameStuff.Sprite ();

If you have put your classes in a different assembly ( project ) then you need to add a reference to your project / assembly.

If you don't have the project in your solution, then you may also need to add the project to the solution, then reference the project from your main app.

Upvotes: 1

user596075
user596075

Reputation:

At the top of your source code:

using YourNameSpace;

Ensure that you have the code library referenced in your project, like so:

  1. In your Object Explorer, locate References
  2. Right-click References and select Add Reference...
  3. Locate the DLL that contains your namespace either in the GAC or through the Browse tab

Upvotes: 4

Related Questions