Menu

Convert byte[] to ubyte[]

2005-10-04
2013-05-01
  • David Thielen

    David Thielen - 2005-10-04

    Hi;

    I'm sure this exists somewhere in the code but I couldn't find it.

    Is there a method to convert a byte[] to a ubyte[]?

    thanks - dave

     
    • Kazuya Ujihara

      Kazuya Ujihara - 2005-10-09

      See JSharpConvert class.It is done like the following.

              public static ubyte[] toUByteArray(byte[] array)
              {
                      if (array == null) return (ubyte[])null;
                      ubyte[] ubyteArray = new ubyte[array.length];
                      System.Buffer.BlockCopy(array, 0, ubyteArray, 0, array.length);
                      return ubyteArray;
              }

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.