Re: [Vala] Problems with HashMap/Dictionary



Thank you so much! That worked perfectly :)

// Kris

2011/10/14 Jens Georg <mail jensge org>

On Fr, 2011-10-14 at 10:09 +0200, Kris Thomsen wrote:
Hi Jens,

Thanks - but would you show me an example on what you mean?

Instead of
private var map;

you need to use
private HashMap<int, string> map;


// Kris

2011/10/14 Jens Georg <mail jensge org>
        On Fr, 2011-10-14 at 09:52 +0200, Kris Thomsen wrote:
        > Hi!
        >
        > I'm new to Vala and therefore I try to translate a
        Java-example to Vala. I
        > have translated the same Java-example to C# before with
        success. In this
        > example they use af HashMap (C#: Dictionary) and I know
        HashMap is a part of
        > LibGee. BUT, I cant make it work, the compiler keep on
        telling me an error:
        >
        > My example:
        >
        > public class ProductCatalog : GLib.Object {
        >         private var map;

        [...]
        > }
        >
        > The compiler gives me this error:
        >
        > [kris odin Udvikling]$ valac --pkg gee-1.0 NextGen.vala
        > NextGen.vala:59.17-59.19: error: syntax error, statements
        outside blocks
        > allowed only in root namespace
        >         private var map;


        You can't use var there, you need the full type.


        _______________________________________________
        vala-list mailing list
        vala-list gnome org
        http://mail.gnome.org/mailman/listinfo/vala-list






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]