Click to See Complete Forum and Search --> : Namespace


cabo
June 6th, 2009, 06:24 AM
Hello all,

its my first day on C#.
I'm trying to use namespaces but its not working.

I'm trying to call a method in namespace namespaceTest.test1 with

testing test = new testing1();. I get this message: The type or namespace could not be found.

Any idea how to edit that line so that i can use the method in namespace namespaceTest.test1


// The C# Station Namespace
namespace namespaceTest
{
namespace namespaceTest.test1
{
// Program start class
class testing1
{
// Main begins program execution.
public int test()
{
Console.WriteLine("This is the new C# Station Namespace 2.");
return 10;
}
}
}

namespace namespaceTest.test2
{

using namespaceTest.test1;
// Program start class
class testing2
{
// Main begins program execution.
public void test()
{
testing test = new testing1();
Console.WriteLine("This is the new C# Station Namespace 2.");
}
}
}

}

darwen
June 6th, 2009, 06:33 AM
testing test = new testing1();


should be


testing1 test = new testing1();


I bet the C# compiler doesn't know what 'testing' is - you haven't defined a 'testing' only a 'testing1' class.

Darwen.

cabo
June 6th, 2009, 08:30 AM
ohh thats so noobies of me. Thank you...like i said this is my first C# day hehe