Conversion problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • twt

    #1

    Conversion problem

    How do I convert a byte[] (properly initialised, of course) to a int?
    I tried (eventually) to use unsafe code and write 'int len=*(int *)bytes',
    where bytes is of type byte[]. Needless to say it didn't work (said I can't
    convert a byte[] to a int * -- I tend to disagree...). Well? What's the
    right way to do it?

    ----------------------------------
    Peace and love,
    Tweety
    mitea@sympatico .ca - tweety_04_01@us ers.sourceforge .net
    YahooID: tweety_04_01


  • Sherif ElMetainy

    #2
    Re: Conversion problem

    Hello

    Use the System.BitConve rter.ToInt32 method

    Best regards

    Sherif

    "twt" <mitea@sympatic o.ca> wrote in message
    news:OGhCtyEjDH A.2636@TK2MSFTN GP11.phx.gbl...[color=blue]
    > How do I convert a byte[] (properly initialised, of course) to a int?
    > I tried (eventually) to use unsafe code and write 'int len=*(int *)bytes',
    > where bytes is of type byte[]. Needless to say it didn't work (said I[/color]
    can't[color=blue]
    > convert a byte[] to a int * -- I tend to disagree...). Well? What's the
    > right way to do it?
    >
    > ----------------------------------
    > Peace and love,
    > Tweety
    > mitea@sympatico .ca - tweety_04_01@us ers.sourceforge .net
    > YahooID: tweety_04_01
    >
    >[/color]


    Comment

    Working...