![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Question on Reflection I have a C#.NET project that passes two parameters to an external S- PLUS function that outputs a value. In my C#.NET project, I'll also need to get the output value from S-PLUS. Therefore, this is an integration program from C#.NET and S-PLUS. I have C#.NET code below to pass two values for the parameters, "a" and "b", to an S-PLUS function, "myFunction". Then the output value from S-PLUS should be returned to my C#.NET code. I have an issue with returned value, result. The correct "result" should be 112. However, in my debugger, it's: result {Dimensions:[1..2,1..2]} [1, 1] 112 I think I should use GetType().InvokeMember to parse result in order to get the value I need, 112. Anyone can advise me on how? Thanks! FYI, my code is below: Type mySFunction = Type.GetTypeFromProgID("S- PLUS.myFunction"); object splusObject = Activator.CreateInstance(mySFunction); object[] oArgs = new object[1]; oArgs[0] = 112; splusObject.GetType().InvokeMember("a", System.Reflection.BindingFlags.SetProperty, null, splusObject, oArgs); oArgs = new object[1]; oArgs[0] = 8; splusObject.GetType().InvokeMember("b", System.Reflection.BindingFlags.SetProperty, null, splusObject, oArgs); splusObject.GetType().InvokeMember("Run", System.Reflection.BindingFlags.InvokeMethod, null, splusObject, null); object result = splusObject.GetType().InvokeMember("ReturnValue", System.Reflection.BindingFlags.GetProperty, null, splusObject, null); |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| reflection, COM, and Vista | .NET General | |||