Example: Get a type from (C-)name

public class MyClass : Object {}

public static int main (string[] args) {
// Register the type:
Type? type = typeof (MyClass);

// Output: ``MyClass``
print ("%s\n", Type.from_name ("MyClass").name ());
type = null;
return 0;
}

 valac --pkg gobject-2.0 GLib.Type.from_name.vala

See:




2022 vala-language.org