I am trying to learn how the NETLink functionality works. Consider the following example:
I import the library:
Needs["NETLink`"];
I fire up the runtime environment:
InstallNET[];
I create a console so I can see things on the .Net side:
ShowNETConsole[]
I try to create an integer on the environment.
integer1=NETNew["System.Int32",4]
It fails
NET::noctor: No public constructor exists for the .NET type System.Int32.
So I just try to create an integer object first.
integer1=NETNew["System.Int32"]
I try to look what value it has by default:
integer1//NETObjectToExpression
0
If someone knows how to change the value of this created integer object from 0 to 4 then please help.
I try another approach:
integer1=MakeNETObject[4]
integer2=MakeNETObject[8]
I try to output the result of simple multiplication on the .Net side:
LoadNETType["System.Console"]
System`Console`Out@WriteLine[integer1]
System`Console`Out@WriteLine[integer2]
System`Console`Out@WriteLine[integer1*integer2]
It is not working. I get 4 and 8 but why am I not getting 32 on my console?
Also why can't I write to the console like this,
console=LoadNETType["System.Console"]
console@WriteLine["Hello world!"]
when I can clear the console like this:
consoleWindow=ShowNETConsole[]
consoleWindow@Clear[]
And what is the difference between the following lines:
System`Console`Out`WriteLine[integer1]
System`Console`Out@WriteLine[integer1]
System`Console`WriteLine[integer1]
System`Console@WriteLine[integer1]
What is the difference between backtick and @ sign? Why sometimes backtick and sometimes @ works?
Needs["NETLink`"]; ShowNETConsole[]; LoadNETType["System.Console"]; Console`Out@WriteLine["Hello from .NET"]– andre314 Mar 24 '20 at 17:28