how to convert an sByte array to byte array

Discussion in 'ASP .Net' started by reju, Feb 21, 2007.

  1. reju

    reju Guest

    I have to convert an sByte array to byte array.
    This sbyte array contains some signed values due to this .net
    converting functions will throw an exception.any work around for this?

    is there any way to pass sbyte array to stream classes eg: memory
    stream?
     
    reju, Feb 21, 2007
    #1
    1. Advertising

  2. Howdy,

    sbyte[] src = new sbyte[] { -1, 1, -2, 2 };
    byte[] dest = new byte[src.Length];
    System.Buffer.BlockCopy(src, 0, dest, 0, src.Length);
    --
    Milosz


    "reju" wrote:

    > I have to convert an sByte array to byte array.
    > This sbyte array contains some signed values due to this .net
    > converting functions will throw an exception.any work around for this?
    >
    > is there any way to pass sbyte array to stream classes eg: memory
    > stream?
    >
    >
     
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=, Feb 21, 2007
    #2
    1. Advertising

  3. reju

    reju Guest

    On Feb 21, 3:02 pm, Milosz Skalecki [MCAD] <>
    wrote:
    > Howdy,
    >
    > sbyte[] src = new sbyte[] { -1, 1, -2, 2 };
    > byte[] dest = new byte[src.Length];
    > System.Buffer.BlockCopy(src, 0, dest, 0, src.Length);
    > --
    > Milosz
    >
    > "reju" wrote:
    > > I have to convert an sByte array to byte array.
    > > This sbyte array contains some signed values due to this .net
    > > converting functions will throw an exception.any work around for this?

    >
    > > is there any way to pass sbyte array to stream classes eg: memory
    > > stream?



    Great Milosz

    it works
    Thanks
     
    reju, Feb 21, 2007
    #3
  4. reju

    RichZilla Guest

    On Feb 21, 3:54 am, "reju" <> wrote:
    > On Feb 21, 3:02 pm, Milosz Skalecki [MCAD] <>
    > wrote:
    >
    > > Howdy,

    >
    > >sbyte[] src = newsbyte[] { -1, 1, -2, 2 };
    > >byte[] dest = newbyte[src.Length];
    > > System.Buffer.BlockCopy(src, 0, dest, 0, src.Length);
    > > --
    > > Milosz

    >
    > > "reju" wrote:
    > > > I have toconvertansBytearray tobytearray.
    > > > Thissbytearray contains some signed values due to this .net
    > > > converting functions will throw an exception.any work around for this?

    >
    > > > is there any way to passsbytearray to stream classes eg: memory
    > > > stream?

    >
    > Great Milosz
    >
    > it works
    > Thanks


    Yeah, Thanks too!
     
    RichZilla, Mar 8, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kirby
    Replies:
    3
    Views:
    684
    Kirby
    Oct 8, 2004
  2. Shane Wealti

    convert byte[] to Byte[]

    Shane Wealti, Jun 13, 2005, in forum: Java
    Replies:
    5
    Views:
    42,601
    Brzezi
    Jun 13, 2005
  3. Replies:
    20
    Views:
    9,951
    licebmi
    Sep 7, 2009
  4. Polaris431
    Replies:
    8
    Views:
    801
    SM Ryan
    Dec 4, 2006
  5. M D

    convert 2 byte space to one byte

    M D, Oct 6, 2006, in forum: Javascript
    Replies:
    3
    Views:
    239
    Dr John Stockton
    Oct 6, 2006
Loading...

Share This Page