Here there is a code snippet showing how to right pad an array (in this case, a byte array).

public static byte[] ByteArrayLeftPad(byte[] input, byte padValue, int len)
{
    var temp = Enumerable.Repeat(padValue, len).ToArray();
    for (var i = 0; i < input.Length; i++)
        temp[i] = input[i];
}

Here you can find how to left pad an array.

Advertisements