= Use Directive = {{{ use use from }}} Specify a namespace contents to make available to this module When using the first form if the compiler cannot immediately locate the namespace,[[BR]] i.e if its not in the default loaded libraries,[[BR]] it will look for a (platform dependent) library-name of the same form as the namespace. If the filename of the library differs from the namespace, you can specify it with the second form.[[BR]] can be a simple identifier, qualified identifier (Foo.Bar) or a string literal. {{{ #!cobra use Foo.Bar from SomeLib }}} You can put single or double quotes around the file name if its components are not legal identifiers [[BR]] (for example, the filename has a space or punctuation mark in it). {{{ #!cobra use Foo.Bar from "My Lib" }}} == Platform == For .Net there are five implicit "use" directives at the top of a Cobra program: {{{ #!cobra use System use System.Collections.Generic use System.IO use System.Text use Cobra.Lang }}} This gives default access to The core of the .Net objects and the cobra runtime Library, !CobraCore. These correspond to access to the following default loaded libraries {{{ mscorlib.dll System.dll Cobra.Lang.dll }}} On .Net will refer to a .Net Assembly or dll[[BR]] No ".dll" extension is expected (or allowed) in any of the above syntax. The library name is the namespace with ".dll" appended e.g {{{ #!cobra use Foo.Bar # On .Net will look for namespace in Foo.Bar.dll if not already available }}} == Examples == {{{ #!cobra use System.Windows.Forms use System.Drawing class MyForm inherits Form def init .text = 'Click Me' listen .click, ref .handleClick def handleClick(sender as Object, args as EventArgs) MessageBox.show('You clicked me!', 'Click') class Program def main is shared Application.run(MyForm()) }}} == Notes == In most cases this syntax means you dont need to specify the commandline -reference switch With !MyProg.cobra containing {{{ #!cobra ... use Foo.Bar ... }}} Instead of compilation by {{{ cobra -reference:Foo.Bar MyProg.cobra }}} you can just say: {{{ cobra MyProg.cobra }}}