Using arrays : Ref param returning array of un-known size. How to handle? on newest questions tagged arrays – Stack Overflow

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.

See Answers


source: http://stackoverflow.com/questions/11227314/ref-param-returning-array-of-un-known-size-how-to-handle
Using arrays : using-arrays



online applications demo