Pass byte array to not static function in class

Hi.
I have to send a byte array to class (class take care about all communication with FTDI) . Unfortunately I can't use static function to do that
 public static void st_SendCommand(ref byte[p,int iSize) will not work because of FTDI dll restrictions. I resolved this situation in other cases when it wasn't array as argument by calling not static function from static and it works. But it is not working with array. I need to send array and size of array to my class  and it those parameters have to be used in some not static function.
How can I do that?
LVL 1
mastiSoftAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MishaProgrammerCommented:
What problem appear when you use array with "ref"?
There is no name of variable  in your code
public static void st_SendCommand(ref byte[p,int iSize)

Open in new window

It must be
public static void st_SendCommand(ref byte[] ArrayName,int iSize);

Open in new window

When you call this method, you should use this construction:
st_SendCommand(ref ArrayName, iSize);

Open in new window

If you use "ref" you should initialize this variale, and then pass it to the method.
If you use "out" instead of "ref". You can not initialize  this, but you should do it in your method before using.
May be you should create property in your class and initialize  this property (array) in constructor?
But I haven't understood what problems with "ref" yet.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndyAinscowFreelance programmer / ConsultantCommented:
It should work without problem.  Basically put the static keyword means that you do not need to create a separate object of that type which is distinct from a second object of the same type.  The static 'shares' the function.

Put another way.
Anything like
public static XXX foo(params) can also be coded as public XXX foo(params).  There is no restriction on the type of variables you use in params.
0
mastiSoftAuthor Commented:
Thank you very much for your help.
0
MishaProgrammerCommented:
Glad to help you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.