Click or drag to resize

IsMethodUsual Function

Check whether a particular method can be sent to an object inside a USUAL.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.10
Syntax
 FUNCTION IsMethodUsual(
	uObject AS USUAL,
	symMethod AS STRING
) AS LOGIC
View Source

Parameters

uObject
Type: Usual
A USUAL containing an object.
symMethod
Type: String
The method name, specified without parentheses.

Return Value

Type: Boolean
TRUE if the specified method is defined for the class of the specified object; otherwise, FALSE.
Remarks
IsMethodUsual() is used to determine whether the polymorphic value <uObject> is an object that has a method <symMethod>.  IsMethodUsual() is the same as the following: UsualType(<uObject>) = OBJECT .AND. IsMethod(<uObject>, <symMethod>).  Thus it should be used instead of IsMethod() in situations where it is not known whether a variable is an object.
Examples
This example uses IsMethodUsual() to check whether a particular method can be sent.  If there is an object and a particular method for it exists, it issues the method; otherwise, it calls a function:
X#
IF IsMethodUsual(uO, #GoTop)
        uO:GoTop()
ELSE
        MyGoTop()        
ENDIF
See Also