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.19
Syntax FUNCTION IsMethodUsual(
uObject AS USUAL,
symMethod AS STRING
) AS LOGIC
public static bool IsMethodUsual(
Usual uObject,
string symMethod
)
Request Example
View SourceParameters
- uObject
- Type: Usual
A USUAL containing an object. - symMethod
- Type: String
The method name, specified without parentheses.
Return Value
Type:
Logic
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:
1IF IsMethodUsual(uO, #GoTop)
2 uO:GoTop()
3ELSE
4 MyGoTop()
5ENDIF
See Also