HighTechTalks DotNet Forums  

vararg SAFEARRAY(VARIANT)* in C#

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss vararg SAFEARRAY(VARIANT)* in C# in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Ruslan Popov
 
Posts: n/a

Default vararg SAFEARRAY(VARIANT)* in C# - 11-14-2005 , 06:56 AM






Hello,

Is there a way to expose to COM a method of a C# type according to the
following IDL:

[vararg] void MyMethod([in, out] SAFEARRAY(VARIANT)* params)

--
Best regards,
Ruslan Popov

Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default RE: vararg SAFEARRAY(VARIANT)* in C# - 11-15-2005 , 03:57 AM






Hi

Here is a sample for your reference.
[ClassInterface(ClassInterfaceType.AutoDual)]
public class TestClass
{
public void
MyMethod([MarshalAs(UnmanagedType.SafeArray,SafeArraySubType =VarEnum.VT_VARI
ANT)]ref System.Array param)
{
;
}
}

Also here is link about Default Marshaling for Arrays in .NET.
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconDefaultMarshalingForArrays.asp


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Reply With Quote
  #3  
Old   
Ruslan Popov
 
Posts: n/a

Default RE: vararg SAFEARRAY(VARIANT)* in C# - 11-16-2005 , 03:31 AM



Hi Peter,

If you look at the resulting IDL more carefully, you'll see your method is
exposed without the vararg attribute, which was the main point. Well, I
managed to get what I want automatically by creating a NAnt task for editing
IDL. Thanks for your help.

--
Best regards,
Ruslan Popov

Reply With Quote
  #4  
Old   
AT
 
Posts: n/a

Default RE: vararg SAFEARRAY(VARIANT)* in C# - 11-16-2005 , 06:32 AM



Hi

Thanks for your knowledge sharing.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.