Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

To declare a namespace, all that is required is that you put namespace followed by a name at the top of your file.

Code Block
borderStylesolid
titledeclaring a namespace
borderStylesolid
namespace Tutorial

class Thing():
    pass

...

To use classes from another namespace, you would use the import keyword.
The most common namespace you will import is System.

Code Block
borderStylesolid
titleimporting from a namespace
borderStylesolid
import System

Console.WriteLine()
Code Block
borderStylesolid
titlenot importing from a namespace
borderStylesolid
System.Console.WriteLine()

...

If you are importing from another assembly, you would use the phrase import <target> from <assembly>, for example

Code Block
borderStylesolid
titleimporting from an external assembly
borderStylesolid
import System.Data from System.Data
import Gtk from "gtk-sharp"

...