Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8160355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:12:01+00:00 2026-06-06T18:12:01+00:00

A COM component exposes an API which expects a ref param of object type.

  • 0

A COM component exposes an API which expects a ref param of object type. As per the documentation of this API, it will fill the ref object with array of values. Now my problem is in prod env I can’t predict the number of elements which I will get back.

Following code will work.

     COMClass objCOM = new COMClass ();
     object colOfInts= new int[10]; // What if I don't know the following will return array of size 10?
     int errorcode = objCOM.FillThisIn(ref colOfInts);

But what if I don’t know the size of array that API returns in ref.

Update here

        object colOfInts = null;
        int errorcode = objCOM .FillThisIn(ref colOfInts);

now when I check the type I get System.Int32[*]

Basically I need to iterate through this array and check for the presence of an element

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:12:03+00:00Added an answer on June 6, 2026 at 6:12 pm

    You are getting back an array whose lower bound isn’t 0. That’s not uncommon in COM interop, the next likely choice is 1. You don’t have to copy it, you can access the elements with Array.GetValue(). Array.GetLowerBound() tells you where to start, Array.GetLength() or Array.GetUpperBound() tells you how far to go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with a COM component which exposes a lot of Variant properties, but
I am trying to use a COM component on Windows in Ruby which expects
I have an ATL COM component method which takes a BSTR as an in
I have an STA COM component which is put into a COM+ application. The
I have a COM component written in C# that makes calls to ConfigurationManager.AppSettings.Get(...). This
I am referencing a COM component from PHP. This COM component returns records using
I have a COM Component DLL. I can use this DLL in VB.NET. But
I have a web application that uses an ActiveX COM component, for example: <OBJECT
I have a Java application which uses a third-party COM component through a Java-COM
I have a VB6 COM component which I need to call from my .Net

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.