GenericArray
Object Hierarchy:
Description:
[ Compact ]
[ CCode ( cname = "GPtrArray" , cprefix = "g_ptr_array_" , ref_function = "g_ptr_array_ref" , type_id = "G_TYPE_PTR_ARRAY" , unref_function = "g_ptr_array_unref" ) ]
[ GIR ( name = "PtrArray" ) ]
public class GenericArray<G>
[ CCode ( cname = "GPtrArray" , cprefix = "g_ptr_array_" , ref_function = "g_ptr_array_ref" , type_id = "G_TYPE_PTR_ARRAY" , unref_function = "g_ptr_array_unref" ) ]
[ GIR ( name = "PtrArray" ) ]
public class GenericArray<G>
Contains the public fields of a pointer array.
Example: Sort all items (with data):
public static int main (string[] args) {
GenericArray<string> array = new GenericArray<string> ();
array.add ("second entry");
array.add ("third entry");
array.add ("first entry");
bool asc = true;
array.sort_with_data ((a, b) => {
return (asc)? strcmp (a, b) : strcmp (b, a);
});
// Output:
// ``first entry``
// ``second entry``
// ``third entry``
array.foreach ((str) => {
print ("%s\n", str);
});
return 0;
}
valac --pkg glib-2.0 GLib.GenericArray.sort_with_data.vala
All known sub-classes:
Namespace: GLib
Package: glib-2.0