Why the string parameter in Excute method is an out parameter

Why the string parameter in Excute method is an out parameter

KM_Yotsuha
Advocate Advocate
303 Views
3 Replies
Message 1 of 4

Why the string parameter in Excute method is an out parameter

KM_Yotsuha
Advocate
Advocate

Revit API document on Excute method of IExternalCommand interface:

KM_Yotsuha_0-1668760628553.png

parameter string is an out parameter,why is that? it should be a ref parameter.

 

0 Likes
Accepted solutions (1)
304 Views
3 Replies
Replies (3)
Message 2 of 4

caroline.gitonga
Autodesk
Autodesk
Accepted solution

Hi @KM_Yotsuha,

This might probably be a slight documentation mistake. The 'message' string parameter on the 'execute' method should be 'ref'. Refer to SDK samples. While the implementations of the two keywords but be slightly close, thank you for noting this and I will reach out to the tech team about it.

Carol Gitonga, Developer Advocacy and Support, ADN Open
Message 3 of 4

mhannonQ65N2
Collaborator
Collaborator

It is an out parameter because it is returned from the Execute method. Making it a ref parameter would imply that it is providing information to the Execute method. Why do you think it should be a ref parameter?

0 Likes
Message 4 of 4

KM_Yotsuha
Advocate
Advocate

because code in visual studio is ref:

KM_Yotsuha_0-1669169212305.png