DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Mon, 16 Jul 2007 15:13:24 -0700,    posted on: microsoft.public.dotnet.framework.interop        back       

Thread Index
  1    jas am


Help to convert a union   
Hi

How to convert this union to C# for COM interop?
I thought of having several C# struct types to cover different switch type. 
But then what about the default type?
How to make sure that all C# structs have correct default size?

Also, in general, when to convert does the field names matter as long as 
they have the correct offset?

Thanks
Jas
--------

typedef struct _VDS_ASYNC_OUTPUT
{
    VDS_ASYNC_OUTPUT_TYPE type;

    [switch_is(type)] union
    {
        [case(VDS_ASYNCOUT_CREATELUN)]
        struct _cl
        {
            IUnknown *pLunUnk;

        } cl;

        [case(VDS_ASYNCOUT_BREAKLUNPLEX)]
        struct _blp
        {
            IUnknown *pLunUnk;

        } blp;

        // CreateTarget() return value
        [case(VDS_ASYNCOUT_CREATETARGET)]
        struct _ct
        {
            IUnknown *pTargetUnk;

        } ct;

        // CreatePortalGroup() return value
        [case(VDS_ASYNCOUT_CREATEPORTALGROUP)]
        struct _cpg
        {
            IUnknown *pPortalGroupUnk;

        } cpg;

        [default]               // This is a dummy member to make the size
        struct _dummy           // of the union identical to that used
        {                       // by the service and software provider.
            ULONGLONG ull;      // (VDS_ASYNCOUT_CREATEPARTITION).
            VDS_OBJECT_ID id;
        } dummy;
    };

} VDS_ASYNC_OUTPUT;
Date:Mon, 16 Jul 2007 15:13:24 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us