Link to home
Start Free TrialLog in
Avatar of deleyd
deleydFlag for United States of America

asked on

How to pass an explicit array of bytes as a byte array

I have a method that accepts a byte array as a parameter:
    private void mymsg(byte[] barray)
    {
      ...
    }

Open in new window

which I currently call:
      byte[] n = { 0x35, 0x04 };
      mymsg( n );

Open in new window

I'd like to call it in one step instead of two. Something like this (but without the syntax errors)
   mymsg( { 0x35, 0x04 } );

Open in new window

What's the proper syntax for this?
ASKER CERTIFIED SOLUTION
Avatar of andrewssd3
andrewssd3
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial