共用方式為


Type.parse Method

Returns an instance of the type specified by a type name. This is a static member that is invoked directly without creating an instance of its class.

var typeVar = Type.parse(typeName, ns);

Parameters

  • typeName
    A string that represents a fully qualified class name. Can be null.

  • ns
    (Optional) The namespace that contains the class.

Return Value

The class represented by typeName, or null if a class that matches typeName does not occur in the namespace.

Exceptions

Exception type

Condition

Error.argument Function

(Debug) typeName cannot be evaluated as a class.

Remarks

Use the parse method to get an instance of a class represented by a specified class-name string. If the namespace is not provided, the class name specified in typeName must be a fully qualified class name that consists of a namespace specification and a class name. If the namespace is provided, a class matching typeName in the specified namespace is returned.

See Also

Reference

Type Class