Message 1 of 6

Not applicable
10-03-2008
12:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm working with an Inventor addin (C#), but I have problems with the events. I use the Inventor 2009 API Reference, but the syntax is in VB or something. For instance:
Public Event OnFileNew( _
ByVal DocumentType As DocumentTypeEnum, _
ByRef TemplateFileName As String, _
ByVal Context As NameValueMap, _
ByRef HandlingCode As HandlingCodeEnum _
)
In C# the "ByVal" seems to be default so I don't have to write anything there. But "ByRef" can be both "ref" and "out" it seems. My problem is to translate this syntax to C#. I managed to translate this OnFileNew event, but generally - how do I know that "ByRef TemplateFileName As String" should be "ref string TemplateFileName" and that "ByRef HandlingCode As HandlingCodeEnum" should be "out HandlingCodeEnum HandlingCode"?
It seems just to be a matter of syntax, so is there any way to autogenerate this code? I use Visual Studio 2005. First I do this:
fileUIEvents.OnFileNewDialog += new FileUIEventsSink_OnFileNewDialogEventHandler(fileUIEvents_OnFileNewDialog);
And here I get problems:
void fileUIEvents_OnFileInsertNewDialog( [PROBLEMS] );
Error 1 No overload for 'fileUIEvents_OnFileNewDialog' matches delegate 'Inventor.FileUIEventsSink_OnFileNewDialogEventHandler'
Public Event OnFileNew( _
ByVal DocumentType As DocumentTypeEnum, _
ByRef TemplateFileName As String, _
ByVal Context As NameValueMap, _
ByRef HandlingCode As HandlingCodeEnum _
)
In C# the "ByVal" seems to be default so I don't have to write anything there. But "ByRef" can be both "ref" and "out" it seems. My problem is to translate this syntax to C#. I managed to translate this OnFileNew event, but generally - how do I know that "ByRef TemplateFileName As String" should be "ref string TemplateFileName" and that "ByRef HandlingCode As HandlingCodeEnum" should be "out HandlingCodeEnum HandlingCode"?
It seems just to be a matter of syntax, so is there any way to autogenerate this code? I use Visual Studio 2005. First I do this:
fileUIEvents.OnFileNewDialog += new FileUIEventsSink_OnFileNewDialogEventHandler(fileUIEvents_OnFileNewDialog);
And here I get problems:
void fileUIEvents_OnFileInsertNewDialog( [PROBLEMS] );
Error 1 No overload for 'fileUIEvents_OnFileNewDialog' matches delegate 'Inventor.FileUIEventsSink_OnFileNewDialogEventHandler'
Solved! Go to Solution.