[Mono-winforms-list] Simple tutorial

Rafael Teixeira monoman at gmail.com
Sun Feb 4 12:39:21 EST 2007


Hi Paul,

Well I can't understand your question, as namespaces don't talk. :)

Namespaces just separate logically groups of classes. When you are
using classes from a namespace, either by having fully qualified
references or with the short form by means of the using clause, you
need to:

1) guarantee there's no collisions on symbols (names)
2) you reference all the assemblies where the implementation for the
needed classes reside (see that the relationships between namespaces
and assemblies is of the  many-to-many kind).

Example for (1):

using System;
namespace My.System {
  class Console {
    public void DoSomething(string message) {
        Console.WriteLine(message); // <<< problem here method not found
           // as it will assume you are referencing My.System.Console
           // you need to fully qualify as below
        System.Console.WriteLine(message);
    }
  }
}

Example for (2)

using System.Windows.Forms;
using System.Collections.Generic;

namespace whatever {

  class MyForm : Form {

...
    System.Xml.XmlReader xr = new ...
}
}

you need to reference System.dll (where the classes for
System.Collections reside), System.Xml.dll and
System.Windows.Forms.dll;

Hope it helps

On 2/4/07, Paul <paul at all-the-johnsons.co.uk> wrote:
> Hi,
>
> Does anyone know of a good, but short and easy to understand app which
> contains multiple namespaces and forms?
>
> I'm having a hell of a time with an app I'm developing which contains
> multiple forms and two namespaces and I can't get them to talk to each
> other properly. I've tried a pile of things, but nothing is going.
>
> TTFN
>
> Paul
> --
> "Mmmmmmmm....Shakira geschmiert mit schokolade" sagt Homer
>
>
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
>
>
>
>


-- 
Rafael "Monoman" Teixeira
---------------------------------------
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man." George Bernard Shaw


More information about the Mono-winforms-list mailing list