how can i convert from double* to ref double?

Firstly, please do not attach your question to old threads. Your question is only vaguely related to the OP's question and this thread was 4 years dead.

I assume you are trying to pass your double* to a method. Does the method require a pointer or a double as input? From your code i am assuming the method takes a reference to a double, but can you calrify that before i give you any code that might be wrong :)

hi
i have an ActiveX in visual C that ActiveX has alot of methods .some of my methodes in this have double* parametrers.
like this Method:
XferCommand(double *Freq);
i add this ActiveX in C#.i want to use Methodes of this ActiveX in C#. when i call method with double* parameters in C# ,it say i mus use ref double for parameters.
like this:
axCDFLAN.XferCommand(ref double).
but i dont want this becauase i want to pas array of feq;
how do i do for this problem?
Thanks Andishe

Firstly, please do not attach your question to old threads. Your question is only vaguely related to the OP's question and this thread was 4 years dead.

I assume you are trying to pass your double* to a method. Does the method require a pointer or a double as input? From your code i am assuming the method takes a reference to a double, but can you calrify that before i give you any code that might be wrong :)

Using Ref double is correct.

When you call the method, pass the first element of the array by ref.
E.g. axCDFLAN.XferCommand(ref myFreqArray[0]) As this is a COM call you might need marshal your array using interop (System.Runtime.InteropServices Namespace).
I have very little experience of interacting with COM objects so I'll leave giving an example of how to do that to someone else.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.