Differences between revisions 1 and 2
Revision 1 as of 2015-02-26 22:21:41
Size: 1703
Comment:
Revision 2 as of 2015-02-26 22:23:16
Size: 1736
Comment:
Deletions are marked like this. Additions are marked like this.
Line 41: Line 41:

CategoryDyalogDotNetUtilities

netVaria

Overview

This Wiki is about sharing snippets of Dyalog Apl code that are useful when using .Net

Obtaining the Net version installed

GetNetVersion is used for detecting the .Net version installed on the computer.

 v←GetNetVersion;DI;dir;dirs;⎕USING
 ⍝ Function to Get the Latest .Net Framework Installed on this Computer

 ⍝ Based on: http://msdn.microsoft.com/en-us/library/y549e41e.aspx 
 ⍝ v = Latest Version Installed
 ⍝ v = 0, When There is no Version of .Net Installed

 :Trap 0
     ⎕USING←'System,mscorlib.dll' 'System.IO,mscorlib.dll'
     dir←Environment.ExpandEnvironmentVariables(⊂'%WINDIR%\Microsoft.NET\Framework')
     DI←⎕NEW DirectoryInfo(⊂dir)             ⍝ Get the DirectoryInfo Object for the Directory
     dirs←DI.GetDirectories(⊂'v*')           ⍝ v* is the filter
     dirs←1↓¨dirs.Name                       ⍝ To remove the letter 'v' at the beginning of each directory
     v←+/¨(⊂1 0.1)ר2↑¨⊃¨(//¨'.'⎕VFI¨dirs)   ⍝ To Add the first 2 numbers of each directory
     v←1↑∪v[⍒v]                              ⍝ To order the directory names as numbers and return the highest number
 :Else
    ⍝ There is no .Net installed
     v←0
 :EndTrap

Clear the Application Domain

CloseAppDomain is the equivalent to File --> CloseAppDomain. It is used to remove the dll loaded in the memory of the interpreter. Usefull when experimenting with .Net.

 CloseAppDomain
⍝ To erase all the loaded dll from memory.
 'Closing AppDomain...'
 1 ⎕NQ'⎕SE.mb.file.closead' 'Select'
 'AppDomain Closed'

CategoryDyalogDotNetUtilities

netVaria (last edited 2015-10-13 16:05:19 by PierreGilbert)