Arrays in C#

Valued Contributor
Valued Contributor



certain methods for SE require an Array as a ref parameter (SolidEdgeGeometry.Vertex.GetPointData for example). In VB.Net I could pass a array of doubles, but in C# I can only pass a System.Array. I realise that I can declare something like:


Array a = new double[] { };


but then when I use the array after the call I have to use (double)a.GetValue(0) to get the first member of the array. Using reflection is one way of doing this, but with ref parameters it gets really messy, and I have to copy the parameters passed back into my array:


byte[] idBytes = new byte[] { };

ParameterModifier refParam = new ParameterModifier(1);

refParam[0] = true;

Object[] args = new Object[] {idBytes};



null, occ, args, new ParameterModifier[] { refParam }, null, null);

idBytes = (byte[])args[0];




Is there a better way??





Posted by: Calum McLellan
Post date: 8/16/2006 8:57:03 PM


RE: Arrays in C#

Valued Contributor
Valued Contributor

I believe you are correct Calum


Posted by: Jason Newell
Post date: 8/21/2006 2:40:30 AM