Hi all
For my app I have to move around datasets of some hundred to a few
thousand entries. These datasets contain several strings, some int (some
enums) and some uint.
I have the data in structs and from these structs I make arrays, e.g.
struct myStruct {
public string some_field;
public int another_field;
}
...
myStructArray[] = {}; //declaration with initalization
myStruct a = myStruct();
a.some_field = "some data";
myStructArray += a;
...
For now, I am using a struct to handle each dataset. But it would also
be possible to do it with (compact) classes.
I heard that structs are stack-allocated and classes are
heap-allocated.
Would there be an advantage/disadvantage for me to use classes instead
of structs? I need no additional features of these classes.
I would do it like:
[Compact]
class myKlass {
public string some_field;
public int another_field;
}
...
myKlassArray[] = {}; //declaration with initalization
var a = new myKlass();
a.some_field = "some data";
myKlassArray += a;
...
Can anybody explain the differences between these two ways of allocating
memory and collecting the data?
Regards
Jörn
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list