Regarding using

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

Moderators: Tech Support, phpbb_admin

Regarding using

Postby Ajay Askoolum » May 30th, 2015, 11:07 am

If I start with:
Code: Select all
⎕cself←'cs' ⎕cse 'Init' 'System'
and then load an assembly
Code: Select all
⎕cse 'LoadAssembly' 'C:\oraclexe\app\oracle\product\10.2.0\server\BIN\Oracle.DataAccess.dll'
and then execute
Code: Select all
⎕cse 'ExecStmt' 'using  Oracle.DataAccess.Client;'
Am I still
Code: Select all
using System;
I'd appreciate a quick response, please.
Ajay Askoolum
 
Posts: 656
Joined: February 22nd, 2007, 2:16 am
Location: United Kingdom

Re: Regarding using

Postby Tech Support » June 3rd, 2015, 1:43 pm

No. This is corroborated by the following passage appearing on page 172 in the current APL+Win C# Script Engine Manual:

"Just as with the CSE ‘Init’ method, the ‘LoadAssembly’ method does not add a ‘using’ statement for a namespace associated with the loaded assembly."

The 'using System;' namespace must be added with an Exec or ExecStmt method.
Tech Support
 
Posts: 1141
Joined: February 10th, 2007, 7:33 am
Location: Rockville, MD

Re: Regarding using

Postby Ajay Askoolum » June 3rd, 2015, 2:26 pm

I think you miss my point.

On the very first line of code, the 'Init' line has 'System': I presume that this is implicitly adding 'using System'.

On the second line of code, I am loading the assembly.

On the third line of code, as it states in the manual, I am adding the 'using' {namespace} (But, I am not repeating 'using System').

My question was: do I need to add 'using System' again or does the implicit usage on the very first line persist i.e. survive?

My experience suggests that it does not persist but I am not sure: hence the question.
Ajay Askoolum
 
Posts: 656
Joined: February 22nd, 2007, 2:16 am
Location: United Kingdom

Re: Regarding using

Postby Davin Church » June 3rd, 2015, 2:41 pm

I'm certainly no expert on the subject, but from their response above I think that you were perhaps making an incorrect initial assumption. If I may shorten their quote from the manual:
...the CSE ‘Init’ method does not add a ‘using’ statement...

which sounds to me like you never had a Using System in the first place, does it not?
Davin Church
 
Posts: 407
Joined: February 24th, 2007, 1:46 am

Re: Regarding using

Postby Tech Support » June 3rd, 2015, 2:50 pm

Davin is correct. The 'using System' statement must be explicitly executed, which was not previously done in your earlier example. If you were under the impression that this was performed implicitly in the execution of the Init method, then that was incorrect.
Tech Support
 
Posts: 1141
Joined: February 10th, 2007, 7:33 am
Location: Rockville, MD


Return to APL+Win & The C# Script Engine

Who is online

Users browsing this forum: No registered users and 0 guests

cron