CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Namespace

  1. #1
    Join Date
    Jun 2009
    Posts
    2

    Namespace

    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

    Code:
     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

    Code:
    // 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.");
                }
            }
        }
    
    }

  2. #2
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Namespace

    Code:
    testing test = new testing1();
    should be

    Code:
    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.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  3. #3
    Join Date
    Jun 2009
    Posts
    2

    Re: Namespace

    ohh thats so noobies of me. Thank you...like i said this is my first C# day hehe

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured