Click or drag to resize

MParamCount Function

X#
Return the number of arguments that a method is expecting.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION MParamCount(
	symClass AS STRING,
	symMethod AS STRING
) AS DWORD
Request Example View Source

Parameters

symClass
Type: String
The symbol of the class containing the method to examine.
symMethod
Type: String
The method name, specified without parentheses.

Return Value

Type: DWord
Remarks
Examples
This example uses MParamCount() to get the number of arguments that the Area method in class Rectangle is expecting. Furthermore, the example sets up a Geometry class with an IdentifyObject() method that uses MParamCount() to collect information about different objects:
X#
 1CLASS Rectangle
 2METHOD Area(x, y) CLASS Rectangle
 3RETURN x*y
 4CLASS Geometry
 5METHOD IdentifyObject(symObject, symMethod);
 6    CLASS Geometry
 7RETURN MParamCount(symObject, symMethod)
 8Function Start()
 9    LOCAL oShapes AS OBJECT
10    ? MParamCount(#Rectangle, #Area)        // 2
11    oShapes := Geometry{}
12    ? "It is a "+NTrim(oShapes:IdentifyObject;
13        (#Rectangle, #Area))+ " dimensional object"
14    // It is a 2 dimensional object
15    RETURN TRUE
See Also