Reputation: 1
How to convert the following VB code to C# code?
Set atDIOAOIPIsReady = _
atDIOGObjRepos.InsertOutputObjectIfNew(sIPIsReadyID, atDIOAOIPIsReady)
My idea is :
atDIOAOIPIsReady -= atDIOGObjRepos.InsertOutputObjectIfNew(ref sIPIsReadyID,atDIOAOIPIsReady);
But it showed me the error as following:
The best overload method match for
ActivVTools._AVTDIOFObjectRepository.InsetOutputObjectIfNew(ref string, ref ActivVTools._IAVTDIOObject)
has some invalid arguments.
Argument '1' must be passed with the 'ref' keyword
ActivVTools.AVTDIOActionObjectClass
to ref ActivVTools._IAVTDIOObject
Upvotes: 0
Views: 211
Reputation: 2167
Based on the documentation(pdf) you need to first create an AVTDIOActionObjectClass object. In the sample they showed, they set the Description property which will not be necessary.
The SET keyword is VB6 and has been used to assign references to a variable. Nowadays with VB.NET this isn`t used/needed anymore.
The C# code would be (see the ref
keyword for the second parameter):
AVTDIOActionObjectClass atDIOAOIPIsReady=new AVTDIOActionObjectClass ();
atDIOAOIPIsReady= atDIOGObjRepos.InsertOutputObjectIfNew(ref sIPIsReadyID,
ref atDIOAOIPIsReady);
Upvotes: 1
Reputation: 117064
Try this:
atDIOAOIPIsReady = atDIOGObjRepos.InsertOutputObjectIfNew(ref sIPIsReadyID, atDIOAOIPIsReady);
Upvotes: 0