The Artima Developer Community
Sponsored Link

.NET Buzz Forum
COM variant arrays and .NET

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Peter van Ooijen

Posts: 284
Nickname: petergekko
Registered: Sep, 2003

Peter van Ooijen is a .NET devloper/architect for Gekko Software
COM variant arrays and .NET Posted: Feb 3, 2006 6:28 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Peter van Ooijen.
Original Post: COM variant arrays and .NET
Feed Title: Peter's Gekko
Feed URL: /error.htm?aspxerrorpath=/blogs/peter.van.ooijen/rss.aspx
Feed Description: My weblog cotains tips tricks and opinions on ASP.NET, tablet PC's and tech in general.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Peter van Ooijen
Latest Posts From Peter's Gekko

Advertisement

Many a COM server exchanges data with its clients using so called variant arrays. These can contain anything you can imagine. Creating a variant array from a COM client can be a hassle. The Delphi VCL framework has the VarArrayCreate function to help you. Creating a variant array from a .NET COM client is even easier as an array of objects is compatible. Take this snippet where the COM server expects an array containing variant bools. The array is declared as an array of object. It's members are filled with booleans.

object[] weeks = new object[sp.ActiveCollege.WeeksPerYear];

 

long match = 1;

for (int i = 0; i < 53; i++)

{

   if ((match & inAct.WeekPatroon) != 0)

       weeks[i] = true;

   else

       weeks[i] = false;

 

    match = match * 2;

}

The server is completely satisfied. No conversions, no hassle. Almost to easy to be true.

Read: COM variant arrays and .NET

Topic: NHibernate Presentation and Northwind Example Previous Topic   Next Topic Topic: Microsoft merge the Exchange and Real-Time Collaboration Groups

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use