CSharp examples for System:Byte Array
Copy From byte array
public class Main{ // requires destination to be pre-sized public static int CopyFrom(this sbyte[] destination, byte[] source, int sourceStartIndex) {//ww w . j a v a 2s. c om for (int i = 0; i < destination.Length; i++) { destination[i] = (sbyte)source[sourceStartIndex++]; } return sourceStartIndex; } // requires destination to be pre-sized public static int CopyFrom<T>(this T[] destination, T[] source, int sourceStartIndex) { for (int i = 0; i < destination.Length; i++) { destination[i] = source[sourceStartIndex++]; } return sourceStartIndex; } }