Call a .Net method directly with APL+Win input

General discussions related to using the C# Script Engine in APL+Win.

Moderators: Tech Support, phpbb_admin

Call a .Net method directly with APL+Win input

Postby joe_blaze » October 18th, 2016, 12:15 am

The CSE 'GetValue' includes the 'value substitution' feature so that it is possible to call a .Net method and immediately return the result to APL+Win using the CSE GetValue method providing the argument to the method directly as an APL+Win value. Multiple arguments are supported. The APL+Win values must be conformable with the argument types of the .Net method.

⎕cself←'c'⎕cse 'Init' 'System' 29999
⎕cse 'ExecStmt' 'using System;'
⎕cse 'ExecStmt' 'public double Add10(double x){return x+10;}' ⍝ Create a .Net method
⎕cse 'GetValue' 'Add10({0})' 100 ⍝ Call the method directly

⎕cse 'ExecStmt' 'public double AddXandY(double x, double y){return x+y;}' ⍝ Create another .Net method
⎕cse 'GetValue' 'AddXandY({0},{1})' 100 10 ⍝ Call the method directly
⎕cse 'GetValue' 'Math.Max({0},{1})' 100 10 ⍝ Use a pre-existing .Net method ⍝ Call the method directly
Posts: 381
Joined: February 11th, 2007, 3:09 am
Location: Box 361 Brielle, NJ 08730-0361

Return to APL+Win & The C# Script Engine

Who is online

Users browsing this forum: No registered users and 1 guest