name


Description:

public unowned string name ()

Get the unique name that is assigned to a type ID.

Note that this function (like all other GType API) cannot cope with invalid type IDs. g_type_invalid may be passed to this function, as may be any other validly registered type ID, but randomized type IDs should not be passed in and will most likely lead to a crash.

Example: Get the (C-)name of a type:

public class MyClass : Object {
}

public static int main (string[] args) {
// Output: ``MyClass``
print ("%s\n", typeof (MyClass).name ());

// Output: ``MyClass``
print ("%s\n", new MyClass ().get_type ().name ());

// Output: ``MyClass``
print ("%s\n", Type.from_instance (new MyClass ()).name ());

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

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

Parameters:

type

type to return name for

Returns:

static type name or null




2022 vala-language.org