#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2012
    Posts
    1
    Rep Power
    0

    Unhappy Problem with pointers in c# unsafe code


    hi,

    i have legacy code written in
    c#
    , .net framework version 1.1
    ,visual studio 2003

    now i am converting code to
    c#
    ,.net framework 3.5
    ,visual studio 2010

    code converted with 0 errors

    but after compile give error in unsafe pointer code

    Error: The right hand side of a fixed statement assignment may not be a cast expression

    Code:
    byte [] bm
    Code:
    fixed (byte* ab = (byte*) &bm[0])
    code given is in unsafe function

    i tried
    Code:
    fixed (byte* ab = &bm[0])
    compile but wrong result.
    Code:
    fixed (byte* ab = bm)
    compile but wrong result.

    don't find anything help full.

    Thank you
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,297
    Rep Power
    9400
    How do you know it's the wrong result if nothing else works at all?

    Or rephrased: are you sure the problem isn't somewhere else in your code?

IMN logo majestic logo threadwatch logo seochat tools logo