Notifications
Clear all
[Closed] Calling C# methods including output parameters
Apr 14, 2010 4:58 am
Greetings
Quick question...
There's a C# method I'd like to call from maxscript which contains an output Parameter.
(as defined in C#)
public static bool Connect(bool localDB, string localDBPath, out int dbVersion)
As i couldn't figure out a working syntax, for the time being I've gotten around it by writing an overload method in C# which does not contain the out parameter, and called it from max using only input variables. I then call a seperate method which returns the parameter.
(as currently called in MXS)
ConnectionMsg = DataAccess.Connect localDB Address
dbVersion = DataAccess.GetConnectedDBversion()
Is there a way to use the original version of the method, and have the output variable from the dotNet method simply write to a local variable called dbVersion?
Thanks muchly for the help.
Mikie
2 Replies
Apr 14, 2010 4:58 am
Have you tried passing the last argument as a by-reference argument?
Connect localDB localDBPath [b]&[/b]dbVersion
Not sure if this works for out parameters or just ref parameters, but might be worth a shot.
Martijn
1 Reply
I hadn’t thought of that! Worked a treat. Makes sense now that I think about it.
Cheers
Mikie