Receives a byte array and returns it transformed in an sbyte array - CSharp System

CSharp examples for System:Byte Array

Description

Receives a byte array and returns it transformed in an sbyte array

Demo Code


using System;//w w w.j a v  a 2  s. c  o  m

public class Main{
        /*******************************/
   /// <summary>
   /// Receives a byte array and returns it transformed in an sbyte array
   /// </summary>
   /// <param name="byteArray">Byte array to process</param>
   /// <returns>The transformed array</returns>
   public static sbyte[] ToSByteArray(byte[] byteArray)
   {
      sbyte[] sbyteArray = null;
      if (byteArray != null)
      {
         sbyteArray = new sbyte[byteArray.Length];
         for(int index=0; index < byteArray.Length; index++)
            sbyteArray[index] = (sbyte) byteArray[index];
      }
      return sbyteArray;
   }
}

Related Tutorials