from_name


Description:

public static Type from_name (string name)

Look up the type ID from a given type name, returning 0 if no type has been registered under this name (this is the preferred method to find out by name whether a specific type has been registered yet).

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

Parameters:

name

type name to look up

Returns:

corresponding type ID or 0